如何在结帐Magento 2上强制更新/刷新送货方式

时间:2017-02-02 09:04:12

标签: magento2

如何刷新结账Magento 2上的送货方式,哪个js功能?

感谢

1 个答案:

答案 0 :(得分:2)

https://alanstorm.com/refresh-shipping-rates-for-the-magento-2-checkout/

    requirejs([
    'Magento_Checkout/js/model/quote',
    'Magento_Checkout/js/model/shipping-rate-registry'
], function(quote, rateRegistry){


    var address = quote.shippingAddress();

    address.trigger_reload = new Date().getTime();

    rateRegistry.set(address.getKey(), null);
    rateRegistry.set(address.getCacheKey(), null);

    quote.shippingAddress(address);
});