SScale Themedocs

Display a coupon code with one-click copy and automatic application to the cart on the product page.

Coupon Code

The Coupon Code block displays a coupon directly on the product page. The customer can copy the code in one click, and optionally, the code is automatically applied when they reach checkout.

How to Add It

  1. Open the Shopify theme editor
  2. Navigate to a product page
  3. Click Add a block
  4. Select Coupon Code
ℹ️This block allows up to 3 instances per section. You can display multiple different coupon codes on the same product page.

How It Works

  1. The customer sees the coupon code displayed on the product page
  2. They click on the code or the copy button
  3. The code is copied to the clipboard
  4. A confirmation message appears ("Code copied!")
  5. If auto-apply is enabled, the code will be pre-filled at checkout

Normal coupon block, 2) Click on the code, 3) "Code copied!" message with check icon)

Settings

Content

SettingTypeDefaultDescription
LabelText"Exclusive offer"Text displayed above the code
Coupon codeTextSAVE10The code to copy
Success messageText"Code copied!"Message displayed after copying
Auto-applyCheckboxYesAutomatically applies the code at checkout
💡The Auto-apply option uses Shopify's ?discount=CODE URL parameter to pre-fill the code at checkout. It is transparent to the customer and eliminates the friction of having to paste the code manually.

Design

SettingTypeOptionsDefaultDescription
StyleSelectSolid / Dashed / Minimal / InlineDashedContainer appearance
SizeSelectSmall / Medium / LargeMediumOverall block size
Border radiusRange0-50px (step 2px)8pxCorner rounding

4 Visual Styles

StyleDescriptionIdeal For
SolidSolid background fillPremium style, highly visible
DashedDashed border (cut-out coupon style)Classic e-commerce, familiar
MinimalClean style without prominent background or borderDiscreet integration into the flow
InlineCompact single-line formatTight spaces, subtle

Colors

SettingTypeOptionsDefaultDescription
Background colorSelectBackground / Background secondary / Foreground / Accent 1 / Accent 2Background secondaryBlock background
Text colorSelectForeground / Background / Accent 1 / Accent 2ForegroundCode and label color
Border colorSelectForeground / Background / Accent 1 / Accent 2ForegroundBorder color (Dashed and Solid styles)

Icon

SettingTypeDefaultDescription
IconSelectpercent_discountIcon displayed before the code
Custom iconImage picker-Custom image as icon

Alignment

SettingTypeOptionsDefaultDescription
Desktop alignmentSelectLeft / Center / RightLeftPosition on desktop
Mobile alignmentSelectLeft / Center / RightLeftPosition on mobile

User Interaction

The block uses an accessible button with aria-label for copying. On click:

  1. The code is copied via the browser's Clipboard API
  2. The copy icon transforms into a check icon
  3. The success message appears briefly
  4. After a few seconds, the interface returns to its normal state
ℹ️Copying works on all modern browsers via navigator.clipboard.writeText(). On older browsers, a document.execCommand('copy') fallback is used.

Use Cases

Sitewide promo

  • Label: "Special offer: 10% off everything!"
  • Code: WELCOME10
  • Dashed style for the classic coupon look
  • Auto-apply enabled for a frictionless experience

Product-specific offer

  • Label: "Exclusive code for this product"
  • Code: PRODUCT20
  • Solid style with Accent 1 background to catch the eye
  • Size: Large

Subtle complementary code

  • Empty or short label ("Coupon code")
  • Code: FREE_SHIP
  • Inline or Minimal style
  • Size: Small
  • Left alignment
⚠️Make sure the displayed coupon code is actually active in Settings > Discounts in your Shopify admin. An expired or invalid code will frustrate the customer at checkout.