Trigger shipping carrier cache to flush

Solved
Highlighted
Shopify Partner
14 2 7

Is there a way to trigger the shipping rate cache to flush?

 

I can see in the documentation that the cache is flushed if any of certain parameters change (https://help.shopify.com/en/api/reference/shipping-and-fulfillment/carrierservice#server-side-cachin...) however what about situations out of these parameters? Such as a rate no longer being available after a certain time or other set of circumstances changing (within the 15 minute cache).

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1129 82 179

Hey Andrew, 

 

I'm not aware of any way the cache can be cleared manually outside of the alteration of the fields mentioned in the docs. It was likely designed this way because of flash sales or weekends such as Black Friday/Cyber Monday, the load on both Shopify and any associated CarrierService can be pretty substantial even with caching.

 

If there was a rate that you served with a time-based expiry, I would suggest to stop serving that rate 15 minutes ahead of time so that caching is no longer a concern. 

0 Likes
Highlighted
Shopify Partner
14 2 7

Hi @Josh,

 

Thanks for the reply! That's understandable.

 

It's a shame because one of the things we're looking to do is provide different rates based on the delivery date chosen in a calendar, without being able to clear the cache this basically impossible because there's no realistic place to put a delivery date in the order or product details that would clear the shipping rate cache if changed, thus you always get the same rate for 15 minutes no matter how many times you change the delivery date.

 

Unless you are aware of any other ways around this that perhaps aren't in the documentation?

 

Thanks,

Andrew

0 Likes
Highlighted
Shopify Expert
220 0 11

Hi @Andrew-W 

 

Did you ever solve this problem?

If you need help with a Shopify customisation, drop me an email on pipparose@etempa.co.uk
0 Likes
Highlighted
Shopify Partner
14 2 7

This is an accepted solution.

hey @Pippa_Ridley_-_ !

I didn't find a way to do exactly what I wanted, however, I did found a workaround that worked for our use case.

With Shopify Plus you can use the Scripts app to hide shipping rates bypassing the rate cache.

Our use case was a shipping calendar and returning different rates depending on the day of the week and a couple of other things. With the day of the week as an example, I would return all rates for all of the days then use the scripts app to hide the irrelevant rates. I would do this using the line item properties.

e.g. If item property delivery day == Saturday then remove all rates that aren't Saturday delivery.

Hope that's useful! Without Plus, of course, I don't believe there is a way around it.

0 Likes
Highlighted
Shopify Expert
220 0 11

Ah that's a shame we're on normal Shopify. But thanks so much for letting me know!

If you need help with a Shopify customisation, drop me an email on pipparose@etempa.co.uk
0 Likes