The Alpha Theme includes a custom JavaScript feature designed to boost conversions. It allows customers to copy a coupon code to their clipboard with a single click. When clicked, a “Copied!” tooltip appears instantly, confirming the action.
This feature is pre-configured in the demo (usually in the site header or promotional banner), but you can recreate it anywhere on your site by following the specific structure required by the theme’s code.
How It Works
The feature relies on two components working together:
- The Text Source: A text block containing the coupon code.
- The Trigger: A button (usually an icon) that triggers the copy action.
Step-by-Step Implementation
To make this work, you must assign specific Classes and IDs to your blocks so the custom script knows where to find the code and which button was clicked.
Step 1: Create the Coupon Text
First, add the text that contains your coupon code (e.g., “Get 10% off with SAVE10”).
- Add a Text (Adv) block.
- Highlight the actual coupon code (e.g., “SAVE10”) and make it Bold.
Important: The script specifically looks for the bold text (the <strong> tag) to decide what to copy. - Go to Advanced > Additional CSS class(es).
- Add the class:
coupon-text-to-copy
Step 2: Create the Copy Button
Next, place a button next to your text. This acts as the trigger.
- Add a Kadence Button (Adv) block.
- Set it to contain only an icon (e.g., the “copy” or “clipboard” icon), or text if you prefer.
- Go to Advanced > HTML anchor.
- Enter the ID:
copy-button
Note: If you are creating a separate version for mobile devices (hidden on desktop), use the IDcopy-button-mobileinstead.
Automatic Feedback (The Tooltip)
You do not need to configure the “Copied!” success message manually. The theme’s custom code handles this automatically:
- Visuals: A tooltip saying “Copied!” appears next to the button for 3 seconds after clicking.
- Styling: The tooltip background color automatically uses Global Palette Color 4 (var(–global-palette4)) to match your theme’s branding.
Troubleshooting
If the button is not working, check the following:
- Did you bold the coupon code? (The script looks for the
strongtag). - Did you use the exact class name
coupon-text-to-copyon the text block? - Did you use the exact ID
copy-buttonin the HTML anchor field of the button?