Using the api for shiping options

New Member
13 0 0

I need to allow free shiping based on some very specific needs using a shipping code:

  • Free ground/standard shipping with FedEx/USPS
  • Does not apply to overnight, 2 day, etc.
  • Does not apply to sale items
  • Without the code the user can do $7.95 flat rate ground

I don't quite understand ho to use the shipping API to make this work. Can anyone give me a high level view on how to go about this?

0 Likes
Shopify Expert
9981 85 1492

Assuming this is relating to Shopify Scripts (given the section you've posted in:

  • check for the existance of the a discount code. 
  • If not code - stop
  • if there's a match, move on and look over the Shipping rates.
  • if there's a standard fedex (example) returned move on, otherwise stop
  • check items in the cart looking for sale items. 
  • if there's sale items - stop. 
  • if you get this far take the standard fedex item and make it free.

^ something vaguely like that.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
New Member
13 0 0

Thanks Jason, that helps me undestand the processes better. Could clarify something? It seems like the shipping is all or nothing so I could calculate the shipping for the whole order but not partial (only calc for the non-sale items), is this correct? Meaning if the user has 10 items that qualify but 1 is a sale the whole thing would "stop" not just calc for the 1 sale item. That seems to be how shopify works. Just wanted to clarify that expectation. 

Thanks you again!

0 Likes
Shopify Expert
9981 85 1492

It's not all or nothing - just how the flow of that Script was laid out. For partial matching, there's nothing stopping you adding ruby logic to instead reduce the shipping price by a smaller amount vs making it completely free.

That seems to be how shopify works.

This makes me wonder if you are talking about Shopify Scripts. Perhaps you're talking about the CarrierService API.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
Highlighted
New Member
13 0 0

Jason, I'm working out a shopify script for this but getting an odd error. Anyway you can help me with this and get me over this hump?

https://ecommerce.shopify.com/c/scripts/t/discount-code-requirements-not-met-error-478989

Thank you!

0 Likes