I have created a shipping script (free shipping for an item if it is the only item present in the cart.) The script works as expected when testing from within the Script Editor. The script also works as expected in the online store if I go through a "normal" flow - adding items to the cart, and then checking out.
However, if I add items to the cart, then go back into the shop and modify the cart contents, then go back to checkout, the script does not seem to re-fire. It keeps the original result from the last execution of the script in the cart. In that case, if I step back to the Shipping Method step, at that point, the script seems to re-fire.
Is there a setting that I am missing or some way to get the script to fire on the checkout page every time the cart contents are modified?
I note that when not using the script editor, the default behavior if the cart contents are changed after a shipping method has been applied, and the customer attempts to come back to the checkout, it goes back to the shipping method page where the customer has to re-select a shipping method. Shouldn't something similar happen if the shipping scripts are not going to re-fire?
Thanks for any advise -
Solved! Go to the solution
Thanks, Elliot. I've abandoned that script, so I do not have a version I can post any longer. However, every shipping script I've developed for the Script Editor has the same issue - if the customer goes back and modifies cart contents, and is directed to the cart page, the scripts do not re-fire unless they step back to the shipping method step. (I have mostly used the Shopify Script Creator - https://jgodson.github.io/shopify-script-creator/ to get started)
I plan on making a very simple script when I have time to demonstrate this problem, hopefully soon.
I was just hoping to get verification from the community that shipping scripts do indeed get re-executed after the cart contents get updated, and the user is directed to the cart page. It seemed more an issue with the execution of the script itself, rather than the script contents, but I could be missing something.
Thank you, Elliot and Duncan.
I'll make a test case and report to Shopify to get their input & update this thread.
The shipping script needs to re-fire on cart and all checkout pages/steps. Otherwise, customers can go back and change cart contents to qualify for free shipping, and it is not applied, or, after getting free shipping, go back and modify cart contents to not qualify, and still get free shipping.
I am relatively new here, so I do not know how reported bugs get tracked, or elevated in priority.
However I can confirm that it was reported to Shopify support:
On May 05 09:21 EDT
I tested this out myself and can see what you are referring to so I looked further into this and can see that this is actually a known issue that our developers are looking into.
I cannot say when this will be addressed and it is a bit of an edge case. Removing the discount code and re-adding it resolves this too, but I do appreciate it is not working as it should.