Coupons
The Coupons module allows you to display information about available coupons directly on the product page with the option of automatic application when adding to cart.
Module Activation
Section titled “Module Activation”The module is optional and must be activated in the main plugin settings under the Additional Modules section.
How It Works
Section titled “How It Works”- Create a standard WooCommerce coupon
- Enable display on the product page in the coupon settings
- A CTA block appears on products the coupon applies to
- The customer can add the product to the cart with the coupon automatically applied
Coupon Settings
Section titled “Coupon Settings”1. Create a WooCommerce Coupon
Section titled “1. Create a WooCommerce Coupon”Marketing → Coupons → Add coupon
Set the standard coupon parameters:
- Coupon code
- Discount type (percentage, fixed amount)
- Usage restrictions
- Validity
2. Enable Display on the Product Page
Section titled “2. Enable Display on the Product Page”In the coupon settings, find the “Add to Cart with Coupon” tab:
| Field | Description |
|---|---|
| Show on Product Detail Page | Enables the CTA block display on products |
| Apply coupon automatically | The coupon is applied automatically when adding to cart |
| Title | CTA block heading |
| Button Text | Button text (supports placeholders) |
Placeholders in Button Text
Section titled “Placeholders in Button Text”| Placeholder | Description |
|---|---|
{coupon_code} | Coupon code |
{discounted_price} | Price after discount |
Example:
Buy for {discounted_price} with coupon {coupon_code}Module Settings
Section titled “Module Settings”Info Block Position
Section titled “Info Block Position”Field: Coupon info block position
Determines where the CTA block is displayed on the product page.
| Position | Description |
|---|---|
| Before add to cart form | Before the add to cart form |
| After add to cart form | After the form |
| Before product summary | Before the product summary |
| After product summary | After the summary |
Block Style
Section titled “Block Style”Field: Coupon box style
| Style | Description |
|---|---|
| Custom / no style | No default styles — use your own CSS |
| Minimal | Simple white box with a border |
| Bordered CTA | Dashed border, warm colors |
| Shined CTA | Bold red block with animation |
Coupon Application Modes
Section titled “Coupon Application Modes”Automatic Application
Section titled “Automatic Application”When “Apply coupon automatically” is enabled:
- The customer clicks the standard “Add to cart” button
- The product is added to the cart
- The coupon is automatically applied
Advantage: Simpler UX, the customer does not need to enter a code.
Manual Application (CTA Block)
Section titled “Manual Application (CTA Block)”When “Apply coupon automatically” is disabled:
- A CTA block is displayed on the product page
- The customer clicks the button in the block
- They are redirected to the cart with the product and applied coupon
Advantage: The customer sees that they are taking advantage of a special offer.
Coupon Validation
Section titled “Coupon Validation”The CTA block is displayed only if:
- The coupon is valid (date, usage limit)
- The coupon applies to the given product
- The product is in stock and can be purchased
- The product has a price (is not free)
- The discount actually reduces the price
CSS Customization
Section titled “CSS Customization”For custom styling, use these CSS classes:
.wpify-woo-discount-coupon-block { /* Wrapper for the entire block */}
.wpify-woo-discount-coupon-block__title { /* Heading */}
.wpify-woo-discount-coupon-block__button { /* CTA button */}Tip: Select the “Custom / no style” style and use your own CSS for full control over the appearance.
Hooks for Developers
Section titled “Hooks for Developers”Modifying CTA Block Data
Section titled “Modifying CTA Block Data”apply_filters( 'wpify_woo_coupons_block_args', $args, $product );Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
$args | array | Data for the template (coupon, title, url, product) |
$product | WC_Product | Current product |
Example
Section titled “Example”/** * Add custom data to the CTA block */function customize_coupon_block( $args, $product ) { $args['custom_message'] = 'Limited offer!'; return $args;}add_filter( 'wpify_woo_coupons_block_args', 'customize_coupon_block', 10, 2 );Frequently Asked Questions
Section titled “Frequently Asked Questions”Can I display multiple coupons on one product?
No. Only the first valid coupon is displayed. If you have multiple coupons for the same product, the one with the lowest order (by name) is shown.
Does it work with both percentage and fixed discounts?
Yes. The module supports both WooCommerce coupon types:
percent- percentage discountfixed_product- fixed product discount
Is the block shown even if the customer has already used the coupon?
Yes. Usage limit validation occurs only when adding to cart. The block is displayed, but when attempting to use it, a WooCommerce error message is shown.
How does it work with variable products?
The coupon is validated against the parent product. If the coupon applies to the product, the CTA block is displayed. When selecting a specific variation, the variation is added to the cart with the applied coupon.