How to apply free shipping after discounts meet the threshold?

Topic summary

Core Issue:
Users want to apply free shipping only when the cart total meets a threshold after discount codes are applied, not before.

Attempted Solutions:

  • Initial approach tried using Shopify Scripts to calculate total_after_discounts by subtracting discounts from subtotal, but struggled to find the right cart object properties.
  • One user suggested a script iterating through line items and applying discount percentages, though this approach may not fully address the issue.

Current Problem:
Shopify’s native free shipping configuration calculates thresholds based on the pre-discount subtotal. This creates a loophole where customers can add items to reach the threshold, then apply discount codes that drop them below it while still receiving free shipping.

Workarounds:

  • One participant resolved their need using Shopify’s built-in shipping configuration (link provided), though this doesn’t solve the post-discount threshold issue.
  • A third-party app (Advanced Free Shipping) was recommended as it can target checkout totals after discounts are applied.

Status: The native Shopify limitation remains unresolved without custom apps or potentially complex scripting solutions.

Summarized with AI on November 1. AI used: claude-sonnet-4-5-20250929.

I want to make shipping free only if the threshold is met AFTER the discounts are applied.

Seems like this script would work perfectly if there was an “Input.cart.total_discount” object, but I can’t seem to find one.

Define the minimum order amount for free shipping

MINIMUM_ORDER_AMOUNT = 75.00

Calculate the total after all discounts have been applied

total_after_discounts = Input.cart.subtotal_price_was - Input.cart.total_discount

Check if the total after discounts is greater than the minimum order amount

if total_after_discounts >= MINIMUM_ORDER_AMOUNT

Apply the free shipping discount

ShippingRate.new(name: “Free Shipping”, price: 0.00, minimum_order_amount: MINIMUM_ORDER_AMOUNT)
end

Some tweaking of the following may assist; if the final price is greater than or equal to 100, the shipping is set to 0.

Input.cart.line_items.each do |item|
item_price = item.original_line_price
item_price -= item.line_price
item_total_price = item.line_price
if Input.cart.discount_code
item_total_price = item_total_price * (1 - Input.cart.discount_code.discount_percentage / 100)
end
if item_total_price >= 100
item.change_line_price(0, message: “Free Shipping”)
end
end

Output.cart = Input.cart

I figure out that I don’t need a cart script to perform this free shipping offer. I just used the shipping configuration available as described here:

https://help.shopify.com/en/manual/shipping/setting-up-and-managing-your-shipping/setting-up-shipping-rates#creating-free-shipping-rates

Honestly, I am having an issue with this also and don’t see a solution in the link you provided.

I’m having the Free shipping default in and then after the customer adds in the discount rate. Even if the total has fallen below the free shipping threshold they can still check out with free shipping.

I just had 2 customers check out with this scenario.

I never noticed this issue before and suspect it may be newly introduced in error.

Yes, the threshold is based on the checkout subtotal (ie. before other discounts).

You can use Advanced Free Shipping and target Checkout Total AFTER other discounts applied.