How to Block Any Coupon When Paying via Gift Card

Im thinking about a way to improve the use of gift cards on my store. As gift cards are merly a method of payment, there’s no way, via admin panel, to set rules for its usage.

Straightforward question: how can I block the use of any coupon in my store whenever the payment is made using gift card?

@hdelara_1 Shopify does not allow this, however, if you are using Shopify Plus you can do it with the help of a code. For Non-Shopify Plus users need an app to achieve this.

For Shopify Plus-- IN setting of the checkout go to the script editor and create a logic

if Input.cart.payment_methods.any? { |payment| payment.type == “gift_card” }
Input.cart.discount_code = nil # Remove applied discount code
end

Output.cart = Input.cart

This script will detect if a gift card is used and will remove any discount applied to the cart.

1 Like

Thanks for the feedback. Im not a Plus user, so I guess I’ll have to use an app.

@hdelara_1 Please let me know if you need any more assistance.

@hdelara_1 ,

  1. If you’re on Shopify plus - it’s possible to remove any applied discount codes on the cart through a checkout extension that checks for any gift cards are applied and then proceeds to remove any discount codes automatically. (API reference) - fairly straightforward to build for you as well.

    Or this can be implemented as a checkout block through the checkout validation API as well.

  2. If you’re not on plus - Discounts / Functions have no way of knowing if a gift card is applied on the cart or not. So there is no option to achieve this behavior that you’re looking to achieve. (reference)

If this helped - can you please mark this as a solution so that others who stumble into this thread can find the right answer.

Best wishes,

1 Like

@hdelara_1 Since quite some time has passed since you raised this thread, I’m assuming you’ve already reached at a solution :slightly_smiling_face:

If my answer helped - can you please mark it as a solution so others who stumble across this thread down the line can also find value from it.

Best,