diff --git a/_dev/js/front/src/service/prestashop.service/prestashop-ps1_7.service.js b/_dev/js/front/src/service/prestashop.service/prestashop-ps1_7.service.js index 988ef7072..47ee04ec7 100644 --- a/_dev/js/front/src/service/prestashop.service/prestashop-ps1_7.service.js +++ b/_dev/js/front/src/service/prestashop.service/prestashop-ps1_7.service.js @@ -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() {