![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/Ecombricks/InventoryCheckout/view/frontend/web/js/view/ |
/** * Copyright © eComBricks. All rights reserved. * See LICENSE.txt for license details. */ define([ 'underscore', 'Magento_Checkout/js/model/quote', 'Magento_Checkout/js/action/select-shipping-method', 'Magento_Checkout/js/checkout-data' ], function (_, quote, selectShippingMethodAction, checkoutData) { 'use strict'; return function (target) { return target.extend({ defaults: { shippingMethodListTemplate: 'Ecombricks_InventoryCheckout/shipping-address/shipping-method-list', shippingMethodItemTemplate: 'Ecombricks_InventoryCheckout/shipping-address/shipping-method-item' }, /** * Get sources * * @returns {Object[]} */ getSources: function () { return quote.getSources(); }, /** * Get source shipping rates * * @param {String} sourceCode * @returns {unresolved} */ getSourceShippingRates: function (sourceCode) { return _.filter(this.rates(), function (shippingRate) { return (sourceCode === shippingRate.source_code); }); }, /** * Get source shipping method * * @param {String} sourceCode * @returns {String} */ getSourceShippingMethod: function (sourceCode) { var sourceShippingMethod = quote.getSourceShippingMethod(sourceCode); return sourceShippingMethod ? sourceShippingMethod.carrier_code + '_' + sourceShippingMethod.method_code : null; }, /** * Select shipping method * * @param {Object} shippingMethod * @returns {Boolean} */ selectShippingMethod: function (shippingMethod) { selectShippingMethodAction(shippingMethod); checkoutData.setSelectedSourceShippingRate(shippingMethod.source_code, shippingMethod.carrier_code + '_' + shippingMethod.method_code); return true; } }); }; });