Enforce stricter thresholds with discount codes
Last updated
Last updated
This is most likely because of discount codes. By way of example: You set free shipping for orders $50 and above. A customer completes checkout on a $44 order and gets free shipping. The threshold is calculated before discounts are applied so if the customer had a $55 order they qualified for free shipping even if though they applied a 20% discount code at checkout bringing their total down to $44.
This is not always ideal even though it averages out and still creates accurate test results. The reason for this behavior is that Shopify does not pass shipping apps like ShipScout any details on the discounts applied.
In this example we will show how to test the following variants while taking into account the subtotal after a discount code has been applied.
Variant A: Free shipping on orders $30 and above
Variant B: Free shipping on order $50 and above
Step 1: Create a shipping rate in Shopify on the desired zone. Set the Price of the shipping rate to be whatever amount you'd like the customer to pay when they are above the free shipping threshold. We will call the rate Standard Shipping:
Step 2: Launch a new threshold test in ShipScout with your 2 variants:
Step 3: Create a new blank template Shipping rates Shopify Script:
Paste the following code into the code area. Before publishing the script you will need to make some modifications:
Change the threshold cents in lines 27 and 33 to match the actual thresholds of your variants.
If you have more than an A and B variant add those after line 36.
Change 'Standard Shipping' on line 24 to match exactly the rate name you set in Step 1 and the rate name in Shopify.
That's it, launch your script!