Skip to main content

Setting up the Coupon Code Rejection extension

Offer shoppers a replacement discount when their coupon code is rejected at checkout

When a shopper enters an invalid or expired coupon and Shopify rejects it ("Enter a valid discount code or gift card"), Coupon Code Rejection detects the failure and offers a replacement discount in real time - as an informational banner or a one-click Claim widget - so you don't lose the sale.

⚠️ Requires an email first. The offer only triggers if the shopper entered their email at checkout before applying the code that was rejected. No email = no replacement offer.

How to set it up

Go to Checkout Components in the left-side menu, then click Add Component and select Discount Code Rejection.

How it works

  1. Shopper enters an invalid code → Shopify rejects it.

  2. PDQ detects the rejection and matches the code against your rules.

  3. On a match, the shopper sees your message (e.g. "Hi David, use SAVE15 just for you!").

  4. They click Claim (or it auto-applies) and a one-time replacement code is applied.

Where to find it: Extensions → Add Extension→ Coupon Code Rejection. Configure four tabs — Settings, Configurations, Appearance, Display Conditions — then add the block in Shopify.


1. Settings

  • Token for Shopify - copy the discount_rejection_coupon_… token for the Shopify block.

  • Internal Name / Description - organizational only.

2. Configurations (your rules)

Reminder banner: the offer only triggers when a customer has entered their email before the rejected code.

Click + Add Rule GroupNew Rule (toggle on/off). Each rule maps rejected codes to a replacement:

  • Internal Rule Title - internal label.

  • Coupon Rule - which rejected codes trigger it:

    • All Coupon Codes · Coupon Code Is (exact match) · Coupon Code Includes (partial match). (No regex/prefix - use "Includes" to catch a family like everything containing "SUMMER".)

  • Message Title / Message Description - shown to the shopper (at least one required). Type { for dynamic fields: {customer.first_name}, {customer.last_name}, {replacement_discount}.

  • Replacement Discount:

    • Do Not Offer Discount - message only (e.g. "that code has expired").

    • Choose From Store Discounts - surface an existing Shopify discount. (Search requires the exact discount code - partial matches return nothing.)

    • Create Unique Discount - PDQ generates a one-time code:

      • Discount Type (Percentage / Value) + Value, Coupon Expiry Days (e.g. 30).

      • Combines With - Product / Order / Shipping Discounts (control stacking).

    • Auto-Apply The Replacement Code - applies it without a click.

You can add multiple rules to handle different code patterns with different offers.

3. Appearance

  • Widget type: Banner (informational) or Clickable Component (adds a button).

  • Widget appearance: Banner Status (Info / Success / Warning / etc.) + Banner Text Color.

  • Button (Clickable): Button CTA Text (default "Claim") + Button Appearance.

4. Display Conditions

  • "This extension will only appear if:" → + Add Rule Group (e.g. Coupons / is not / Free shipping, with an optional Include PDQ Coupons checkbox).

  • Failed Attempt Threshold (toggle) - only show after N invalid attempts:

    • Attempts (e.g. 2), optionally Limit Attempts Within A Time Window (e.g. 5 minutes). The UI summarizes it, e.g. "Trigger after 2 failed attempts within 5 minutes."

⚠️ First-timer display conditions: if you gate this to new customers, use Customer order count ≤ 0, not "= 0". "Equal 0" silently hides the extension for guests (whose order count reads as unknown until they're identified), so it looks dead in testing. And any order-count condition only resolves after the email is entered - don't judge it "not working" in a pre-email QA session.

Install in Shopify

Shopify → Settings → Checkout → EditAdd block → PDQ Discount Rejection Coupon (near the discount field / order summary) → paste the token into Configuration Token → Save.

Good to know

  • Generated coupons are one-time-use, tied to the shopper's email.

  • Combines With only appears for Create Unique Discount - set it so the replacement doesn't clash with existing promos.

  • [VERIFY] The extension relies on PDQ's Web Pixel to detect rejections (make sure it's active), and rejection data is held briefly (~180s) - not documented in Confluence; confirm before publishing.

Did this answer your question?