Skip to content

Commit

Permalink
[ECP-8770-v2] Remove the unavailable shipping method from the response (
Browse files Browse the repository at this point in the history
#72)

Co-authored-by: hossam-adyen <[email protected]>
  • Loading branch information
candemiralp and hossam-adyen authored Jan 11, 2024
1 parent 24ec9bb commit 4006b00
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion view/frontend/web/js/googlepay/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,15 @@ define([
activateCart(this.isProductView)
.then(() => getShippingMethods(payload, this.isProductView))
.then(function (response) {
// Stop if no shipping methods.

// If the shipping_method is not available, remove it from the response array.
for (let key in response) {
if (response[key].available === false) {
response.splice(key, 1);
}
}

// Stop if no shipping methods.
if (response.length === 0) {
reject($t('There are no shipping methods available for you right now. Please try again or use an alternative payment method.'));
return;
Expand Down

0 comments on commit 4006b00

Please sign in to comment.