Hide shipping methods when a discount is applied
Some stores don't want discounted orders to use a premium delivery option, for example no express shipping on orders that already use a promo. ShipWith can hide selected delivery methods when the order has a discount applied.
What this rule can and can't check
Shopify doesn't pass the discount code itself to delivery customizations. ShipWith's Order discount condition knows whether a discount is applied to the cart's items, but not which code was used. That means:
- Any discount code or automatic discount on the items triggers the rule, not just one specific code such as
WELCOME10. - Shipping-only discounts, such as a free shipping code, don't trigger it.
If you need to target one specific promotion, use conditions you can see instead, such as products in a promo collection or a customer tag.
Start from a ready-made rule
Download hide-shipping-when-discount-code-used.json and import it from the ShipWith Dashboard with Import. The rule uses Standard input and hides delivery methods whose title or handle contains Express when an order discount is applied. It imports as Off.
After importing, change Express to match your own delivery method titles, then set Status to Live, select Save, and wait for Synced. See Export and import shipping rules for details. To build the rule yourself instead, follow the steps below.
Create the rule
- Create a shipping rule and enter a Rule name, such as
Hide Express on discounted orders. - Keep Standard input for Function input.
- Under When the rule runs, select When set conditions are met.
- In Conditions, select Order discount, then is, and keep the value
true. - Under Actions, select Hide specific delivery method(s). In Delivery method titles, enter
expressor another title or handle fragment and press Enter. - Set Status to Live, select Save, and wait for Shopify sync to show Synced.
Matching ignores capitalization and can match any part of a title or handle, so express also hides a method called Priority Express. Check your targets and leave at least one delivery option available.
Test the rule at checkout
- Start a checkout without a discount. Confirm that the express option is shown.
- Apply a discount code that reduces the item price. Confirm that the express option disappears.
- Try a free-shipping-only code if you use one. The express option should stay visible, because shipping-only discounts don't trigger the condition.
