verifyIfHasShippingMethodsInAllPaymentTypes

PHOTO EMBED

Tue Jul 05 2022 13:59:08 GMT+0000 (Coordinated Universal Time)

Saved by @elias #javascript

verifyIfHasShippingMethodsInAllPaymentTypes: function () {
  var widget = this;
  var selectedShippingMethod = widget.cart().shippingMethod();
  var shippingMethodNotAvailable = widget.paymentTypes().some(function (paymentType) {
      if (!(paymentType.hasOwnProperty('freights') && paymentType.freights && paymentType.freights.includes(selectedShippingMethod))) {
          return paymentType
      }
  })
  if (!shippingMethodNotAvailable) {
      widget.enableAllPaymentTypes(true);
  }
},
content_copyCOPY