Skip to content

Commit

Permalink
Fix price calculation issue my jetpack (#35492)
Browse files Browse the repository at this point in the history
* Fix Price calculation issue on My Jetpack

* changelog

* Update project version

* update version numbers
  • Loading branch information
CodeyGuyDylan committed Feb 7, 2024
1 parent 9b0d6d0 commit 96450fa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ const ProductDetailTableColumn = ( {
}, [ trackProductButtonClick, onProductButtonClick, runCheckout, detail, tier ] );

// Compute the price per month.
const price = fullPrice ? Math.ceil( ( fullPrice / 12 ) * 100 ) / 100 : null;
const price = fullPrice ? Math.round( ( fullPrice / 12 ) * 100 ) / 100 : null;
const offPrice = introductoryOffer?.costPerInterval
? Math.ceil( ( introductoryOffer.costPerInterval / 12 ) * 100 ) / 100
? Math.round( ( introductoryOffer.costPerInterval / 12 ) * 100 ) / 100
: null;

const isOneMonthOffer =
Expand Down
4 changes: 2 additions & 2 deletions projects/packages/my-jetpack/_inc/state/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ export const getProduct = ( state, productId ) => {

product.pricingForUi.fullPricePerMonth =
product.pricingForUi.productTerm === 'year'
? Math.ceil( ( product.pricingForUi.fullPrice / 12 ) * 100 ) / 100
? Math.round( ( product.pricingForUi.fullPrice / 12 ) * 100 ) / 100
: product.pricingForUi.fullPrice;

product.pricingForUi.discountPricePerMonth =
product.pricingForUi.productTerm === 'year'
? Math.ceil( ( product.pricingForUi.discountPrice / 12 ) * 100 ) / 100
? Math.round( ( product.pricingForUi.discountPrice / 12 ) * 100 ) / 100
: product.pricingForUi.discountPrice;

return product;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fixes issue on My Jetpack interstitials where some prices are 1 cent off

0 comments on commit 96450fa

Please sign in to comment.