Skip to content

Commit

Permalink
Fix Pay Later amount
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt75 committed Mar 5, 2024
1 parent 8331d46 commit 39a1f90
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,26 @@ export class PrestashopPs1_7Service {
return !!window.ps_checkoutCartProductCount;
}

static displayPricesTaxIncluded() {
return window.prestashop?.configuration?.display_prices_tax_incl || false;
}

static displayTaxLabel() {
return window.prestashop?.configuration?.display_taxes_label || false;
}

static getCartAmount() {
return window.prestashop?.cart?.totals?.total?.amount || '';
let cartAmount = window.prestashop?.cart?.totals?.total?.amount || '';

if (window.prestashop?.cart?.totals?.total_excluding_tax?.amount && !this.displayPricesTaxIncluded() && !this.displayTaxLabel()) {
cartAmount = window.prestashop?.cart?.totals?.total_excluding_tax?.amount;
}

if (window.prestashop?.cart?.totals?.total_including_tax?.amount && (this.displayPricesTaxIncluded() || this.displayTaxLabel())) {
cartAmount = window.prestashop?.cart?.totals?.total_including_tax?.amount;
}

return cartAmount;
}

static getProductPrice() {
Expand Down

0 comments on commit 39a1f90

Please sign in to comment.