-
+
+
diff --git a/view/frontend/web/js/view/checkout/applepay/checkout-cart.js b/view/frontend/web/js/view/checkout/applepay/checkout-cart.js
index 42e026c20..8823a1989 100644
--- a/view/frontend/web/js/view/checkout/applepay/checkout-cart.js
+++ b/view/frontend/web/js/view/checkout/applepay/checkout-cart.js
@@ -32,9 +32,9 @@ define(
'use strict';
return {
- showPayButton: function () {
+ showPayButton: function ($page) {
applepayPay.setQuote(quote);
- applepayPay.showPayButton('cart');
+ applepayPay.showPayButton($page);
applepayPay.transactionResult.subscribe(
function () {
diff --git a/view/frontend/web/js/view/checkout/applepay/pay.js b/view/frontend/web/js/view/checkout/applepay/pay.js
index 700db28ca..ae4efa01f 100644
--- a/view/frontend/web/js/view/checkout/applepay/pay.js
+++ b/view/frontend/web/js/view/checkout/applepay/pay.js
@@ -392,9 +392,9 @@ define(
}
}.bind(this),
})
- .fail(function() {
- this.timeoutRedirect();
- }.bind(this));
+ .fail(function() {
+ this.timeoutRedirect();
+ }.bind(this));
return update;
} else if (this.payMode == 'cart') {
@@ -432,9 +432,9 @@ define(
}
}.bind(this),
})
- .fail(function() {
- this.timeoutRedirect();
- }.bind(this));
+ .fail(function() {
+ this.timeoutRedirect();
+ }.bind(this));
return update;
} else {
@@ -548,9 +548,9 @@ define(
}
}.bind(this),
})
- .fail(function() {
- this.timeoutRedirect();
- }.bind(this));
+ .fail(function() {
+ this.timeoutRedirect();
+ }.bind(this));
return update;
@@ -607,10 +607,22 @@ define(
initProductViewWatchers: function () {
this.devLog('==============applepaydebug/initProductViewWatchers');
- this.productSelected.id = $('.price-box').attr('data-product-id');
- this.productSelected.qty = $('#qty').val();
- var self = this;
+ var productId = $('.price-box').attr('data-product-id');
+ var productQty = $('#qty').val();
+
+ if (!productId) {
+ console.error('Product ID not found on the page.');
+ return;
+ }
+
+ if (!productQty) {
+ productQty = 1;
+ }
+ this.productSelected.id = productId;
+ this.productSelected.qty = productQty;
+
+ var self = this;
$('#qty').change(function() {
self.productSelected.qty = $(this).val();
});