script does not seem to fire after changes to cart

Highlighted

Hello -

 

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 -

 

Gabriel

0 Likes
Shopify Partner
131 1 15

Hi Gabriel,

 

Could you post the script? We'll be shooting in the dark a little if we can't see what errors could be occuring.

 

Cheers,

Elliott

Feeling a bit lost? Contact elliot@mandelbrotian.com for help with theme setup, alterations, custom functionality, and app development.
0 Likes

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.

0 Likes
Shopify Partner
289 22 32

I believe each one fires when the proper page loads, which would confirm your thoughts.

Line item fires on Add to cart, Shipping on Shipping page, and Payments on payment page.

Best Regards,
Duncan.
Isle of misfit code & development
http://ecomdev.ca
0 Likes
Shopify Partner
131 1 15

Yup, in my experience that's how it works. Best of luck!

Feeling a bit lost? Contact elliot@mandelbrotian.com for help with theme setup, alterations, custom functionality, and app development.
0 Likes

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.

0 Likes

status: Shopify is aware of this issue, but they consider it an edge case, so there does not appear to be much priority for fixing it. I'll update this if I get news of a fix.

0 Likes