0

What i want that,when customer goes on checkout page generally select shipping method but if he came back to cart then again go to checkout in that case shipping should be reset.

But Magento 2 generally do,it keeps the data in cache when we go to checkout then if again come back then it load from there.

Could any one know about this how we can approach it?

2

You can reset the shipping method as :

Go to vendor\magento\module-checkout\view\frontend\web\template\shipping-address\shipping-method-list.phtml

and replace the line 10 code from

<input type="radio"
               class="radio"
               ifnot="method.error_message"
               ko-checked="element.isSelected"
               ko-value="method.carrier_code + '_' + method.method_code"
               attr="'aria-labelledby': 'label_method_' + method.method_code + '_' + method.carrier_code + ' ' + 'label_carrier_' + method.method_code + '_' + method.carrier_code,
                    'checked': element.rates().length == 1 || element.isSelected" />

To :

<input type="radio"
               class="radio"
               ifnot="method.error_message"
               ko-value="method.carrier_code + '_' + method.method_code"
               attr="'aria-labelledby': 'label_method_' + method.method_code + '_' + method.carrier_code + ' ' + 'label_carrier_' + method.method_code + '_' + method.carrier_code" />

And run the php bin\magento setup:upgrade command.

Note : Override the file in your theme, do not change directly in the core file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.