[FIX] payment: express checkout removed for free carts

If user changed quantity of products to amount that would create free
cart, without refreshing the page, they were still able to use express
checkout which was causing an error.
If user has free cart now, it will make express checkout button dissapear.

task-3568644

closes odoo/odoo#160386

X-original-commit: 0b47abaa6d682fb5c243d1b36dbed263343ce586
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: anko-odoo <anko@odoo.com>
This commit is contained in:
Anita (anko)
2024-04-04 09:52:50 +00:00
parent c6640ddafd
commit e2c6b088f0
@@ -82,6 +82,13 @@ publicWidget.registry.PaymentExpressCheckoutForm = publicWidget.Widget.extend({
_updateAmount(newAmount, newMinorAmount) {
this.paymentContext.amount = parseFloat(newAmount);
this.paymentContext.minorAmount = parseInt(newMinorAmount);
this._getExpressCheckoutForms().forEach(form => {
if (newAmount == 0) {
form.classList.add('d-none')}
else {
form.classList.remove('d-none')
}
})
},
});