Hide a shipping method when a specific coupon used

Hide a shipping method when a specific coupon used

nickblue
Shopify Partner
8 0 0

Hi, guys

Just wondering how I can hide a shipping method when a specific coupon used in checkout.

As a web developer, any API is available for this kind of situation?

Your help will be appreciated.

 

Replies 8 (8)

michaeltheodore
Explorer
59 6 9

What framework are you using?

nickblue
Shopify Partner
8 0 0

Hi, Michael

Do you mean what framework I'm gonna use in my App?

 

michaeltheodore
Explorer
59 6 9

Are you using the Storefront API?

nickblue
Shopify Partner
8 0 0
I could use Storefront API.

Can you please give me an example of how to achieve this?
michaeltheodore
Explorer
59 6 9

There is no shipping method object in the Storefront API. Only the Admin API has it.

If you don't want to add a shipping method at checkout, you don't have to.

 

Mircea_Piturca
Shopify Partner
1548 44 347

If you are on Plus, you can do this via Scripts: https://help.shopify.com/en/manual/checkout-settings/script-editor

You would create a Shipping Script, detect the coupon used, and disable the gateway.

Finally—Add variant descriptions to your products

michaeltheodore
Explorer
59 6 9

All Shopify plans include discount codes. There is a limit of 20,000,000 unique discount codes for each store.

https://help.shopify.com/en/manual/discounts/create-discount-codes

Rohan-developer
Shopify Partner
42 0 0

Hello,

 

I can suggest an alternative solution. You can hide a shipping method using the “Discount amount” condition to approximate this using ShipRight app. Firstly identify the discount amount associated with the specific coupon.

 

  1. Open the app and click the "Add a new rule" button.
  2. Select the "Discount amount" condition.
  3. Set "Hide if more than" based on the discount amount.
  4. Select the shipping method you want to hide in the "Select shipping methods" field.
  5. If your exact shipping option is not listed in the above field, add it in the "Additional shipping methods" field.
  6. Save the rule by clicking the "Save" button.

discount-amount.png

This method hides the shipping method when the discount amount matches that of the specific coupon. However, it may affect other coupons with the same discount value.