This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

How to Create WooCommerce Coupon Codes: A Complete Guide

Updated on March 9, 2026

13 Min Read
WooCommerce coupons article banner

Key Takeaways

  • WooCommerce has three built-in coupon types: percentage discount, fixed cart discount, and fixed product discount, plus a free shipping option.
  • Coupon codes are not case-sensitive in WooCommerce; “SAVE20” and “save20” will both work at checkout.
  • The coupon menu moved in recent WooCommerce versions. The correct path is now Marketing → Coupons, not WooCommerce → Coupons.
  • Developers can create and auto-apply coupons programmatically using wp_insert_post() and the woocommerce_before_cart hook, giving store owners far more flexibility than the default UI.

Coupons are one of the most reliable levers a WooCommerce store owner has. Used right, they recover abandoned carts, reward loyal customers, and accelerate slow-moving inventory. But the default WooCommerce coupon interface leaves a lot on the table, and most tutorials barely scratch the surface of what’s possible.

This guide covers everything: the coupon types available to you, a complete step-by-step walkthrough for creating coupons through the WooCommerce UI, how to auto-apply coupons via PHP, how to generate coupons programmatically, the best coupon plugins in 2026, and how to troubleshoot when something goes wrong.

Whether you’re a store owner setting up your first promotion or a developer who wants programmatic control over discounts, you’re in the right place.

Types of WooCommerce Coupons

Before creating anything, it helps to know which coupon type fits your goal. WooCommerce ships with four discount mechanisms out of the box:

Type What it does Best used for Example
Percentage discount Reduces the cart subtotal or specific products by a percentage Seasonal sales, welcome offers, influencer codes 20% off entire order
Fixed cart discount Deducts a flat dollar amount from the entire cart Minimum spend promotions (“spend $100, save $15”) $15 off orders over $100
Fixed product discount Deducts a flat amount per item from specific products only Clearing slow-moving SKUs, product-specific promotions $5 off a specific t-shirt
Free shipping Waives the shipping fee when the coupon is applied Cart abandonment recovery, email campaigns Free shipping on any order

Advanced coupon types like BOGO (Buy One, Get One) and role-based discounts require plugins, which we’ll cover in the plugins section below.

How to Enable Coupons in WooCommerce

Coupons are enabled by default in most WooCommerce installations, but it’s worth confirming before you spend time building a promotion.

  1. Go to WooCommerce → Settings in your WordPress dashboard.
  2. Click the General tab.
  3. Scroll down to the Coupon section and make sure “Enable the use of coupon codes” is checked.
  4. You’ll also see a second option: “Calculate coupon discounts sequentially.” This controls what happens when a customer applies multiple coupons. When checked, the second coupon applies to the already-discounted price; when unchecked, both coupons apply to the original full price.
  5. Click Save changes.
💡 Note: The sequential discounting option matters for stacking promotions. For example, a store-wide 20% sale combined with a loyalty 10% code — sequential mode gives 10% off the already-discounted price, not 30% total.

How to Create a WooCommerce Coupon (Step-by-Step)

Step 1: Navigate to Marketing → Coupons

In your WordPress dashboard, go to Marketing → Coupons. If you don’t see the Marketing menu, make sure you’re running WooCommerce 4.0 or later. Older tutorials point to the old WooCommerce → Coupons path, which no longer exists in modern versions.

Click Add coupon to open the coupon editor.

Step 2: Set Your Coupon Code and Description

You have two ways to set the coupon code:

  • Type it manually — enter any combination of letters, numbers, and special characters. Coupon codes are not case-sensitive, so SAVE20 and save20 are identical to WooCommerce.
  • Generate automatically — click the “Generate coupon code” button for a random alphanumeric string. WooCommerce intentionally excludes ambiguous characters (0/O, l/1) to prevent customer confusion.

The Description field is for internal notes only, customers never see it. Use it to record what the coupon is for, which campaign it belongs to, or when it expires. This saves headaches when reviewing a list of dozens of coupons months later.

Step 3: Configure General Settings

Scroll down to the Coupon data block. Under the General tab, configure:

  • Discount type: Choose percentage discount, fixed cart discount, or fixed product discount.
  • Coupon amount: Enter the numeric value. For a 20% discount, enter 20. For a $15 flat discount, enter 15.
  • Allow free shipping: Check this box if you want the coupon to also waive the shipping fee, regardless of the discount type.
  • Coupon expiry date: Set a specific end date, or leave it blank for a coupon that never expires. Always match this to whatever date you’ve communicated in your marketing campaigns.

WooCommerce coupon configuration screen showing discount type, coupon amount, and expiry date settings

Step 4: Set Usage Restrictions

This tab is where most tutorials stop short. Usage restrictions give you precise control over when and how a coupon can be applied.

  • Minimum spend / Maximum spend: Set a cart subtotal threshold. For example, a minimum of $50 prevents the coupon from applying to very small orders. The amount is evaluated before tax.
  • Individual use only: When checked, this coupon cannot be combined with other coupons in the same order.
  • Exclude sale items: Prevents the coupon from stacking on top of products already marked on sale.
  • Products / Exclude products: Restrict the coupon to specific product IDs, or exclude specific products from being discounted.
  • Product categories / Exclude categories: Restrict or exclude entire product categories.
  • Allowed emails: Limits coupon use to specific email addresses verified against the customer’s billing email. You can use wildcards — for example, *@yourdomain.com restricts the coupon to company employees only.

Step 5: Set Usage Limits

Under the Usage limits tab:

  • Usage limit per coupon: The maximum number of times this coupon can be used across all customers. Once hit, the coupon automatically becomes invalid.
  • Limit usage to X items: For fixed product discounts, caps how many items per order the coupon applies to.
  • Usage limit per user: How many times a single customer (identified by email address or account) can apply this coupon.

Step 6: Publish

Click Publish in the top-right corner. Your coupon is now live. Customers can enter the code in the coupon field on the cart or checkout page to receive their discount.

Coupon Naming Best Practices

Your coupon code is part of the customer experience. A code like X3YZQ89F causes typos and confusion at checkout. A code like SUMMER26 is memorable, shareable, and tells customers what the offer is at a glance.

Some practical guidelines for 2026:

  • Keep codes short: Aim for 6–12 characters. Longer codes get mistyped on mobile.
  • Make them campaign-specific: WELCOME10, BLACKFRI26, LOYALTY20. This also helps you track performance per channel.
  • Use uppercase: It looks clean on a banner or email, and since WooCommerce isn’t case-sensitive, it doesn’t matter what the customer types.
  • Avoid look-alike characters: Don’t include 0/O, l/1, or I in manually created codes. The auto-generator already avoids these.
  • Use unique codes for high-value campaigns: If a coupon offers 40%+ off, use single-use unique codes rather than a shared code to prevent unauthorized distribution. Bulk-generate these with a plugin like Coupon Generator for WooCommerce.

How to Auto-Apply WooCommerce Coupons

The WooCommerce UI has no built-in auto-apply feature; by default, customers always have to enter a code manually. There are two developer-friendly ways to apply coupons automatically without any customer action.

Option 1: URL-Based Auto-Apply

WooCommerce supports a coupon URL parameter that applies the discount as soon as a customer clicks the link. This is ideal for email marketing campaigns or dedicated landing pages:

https://yourstore.com/?add-to-cart=123&coupon_code=WELCOME10

Replace 123 with the product ID and WELCOME10 with your coupon code. When the customer visits this URL, the product is added to their cart and the coupon is applied automatically — no manual entry required.

Option 2: Auto-Apply via PHP Hook

For more control (such as auto-applying a coupon when a specific product is in the cart) use the woocommerce_before_cart action hook. Add the following to your child theme’s functions.php or a dedicated code snippets plugin:

add_action( ‘woocommerce_before_cart’, ‘cw_auto_apply_coupon’ );

function cw_auto_apply_coupon() {
$coupon_code = ‘WELCOME10’;

// Don’t apply if already applied
if ( WC()->cart->has_discount( $coupon_code ) ) return;

// Check if a specific product is in the cart
$target_product_ids = array( 65, 102 ); // Add your product IDs here

foreach ( WC()->cart->get_cart() as $cart_item ) {
if ( in_array( $cart_item[‘product_id’], $target_product_ids ) ) {
WC()->cart->add_discount( $coupon_code );
break;
}
}
}

To apply a coupon automatically on all products (store-wide), simplify the function:

add_action( ‘woocommerce_before_cart’, ‘cw_auto_apply_sitewide_coupon’ );

function cw_auto_apply_sitewide_coupon() {
$coupon_code = ‘HOLIDAYSALE’;

if ( ! WC()->cart->has_discount( $coupon_code ) ) {
WC()->cart->add_discount( $coupon_code );
}
}

⚠️ Important: Always add this code to your child theme’s functions.php, not the parent theme. Better still, use a plugin like Code Snippets to manage PHP additions — it prevents code loss on theme updates and lets you toggle snippets on/off without touching core files.

To find a product’s ID, go to Products → All Products in your dashboard. The ID appears below each product name in the list view.

WordPress Products list showing where to find the Product ID below each product name

Creating WooCommerce Coupons Programmatically (PHP)

For developers who need to generate coupons dynamically (such as post-purchase loyalty codes, referral rewards, or batch promotions) WooCommerce stores coupons as WordPress custom post types (shop_coupon). This means you can create them with wp_insert_post() and configure all their properties via update_post_meta().

Here’s a complete function that creates a fully configured coupon:

function cw_create_coupon_programmatically() {

$coupon_code = ‘CLOUDWAYS26’; // Your coupon code
$discount_type = ‘percent’; // ‘percent’, ‘fixed_cart’, or ‘fixed_product’
$amount = ’15’; // Discount value

$coupon = array(
‘post_title’ => $coupon_code,
‘post_status’ => ‘publish’,
‘post_author’ => 1,
‘post_type’ => ‘shop_coupon’,
‘post_excerpt’ => ‘2026 Cloudways promotional coupon’,
);

$new_coupon_id = wp_insert_post( $coupon );

// Core discount settings
update_post_meta( $new_coupon_id, ‘discount_type’, $discount_type );
update_post_meta( $new_coupon_id, ‘coupon_amount’, $amount );
update_post_meta( $new_coupon_id, ‘free_shipping’, ‘no’ );

// Usage restrictions
update_post_meta( $new_coupon_id, ‘individual_use’, ‘no’ );
update_post_meta( $new_coupon_id, ‘exclude_sale_items’, ‘no’ );
update_post_meta( $new_coupon_id, ‘product_ids’, ); // Leave empty for all products
update_post_meta( $new_coupon_id, ‘exclude_product_ids’, );
update_post_meta( $new_coupon_id, ‘minimum_amount’, ); // Minimum cart value

// Usage limits
update_post_meta( $new_coupon_id, ‘usage_limit’, ); // Total uses (empty = unlimited)
update_post_meta( $new_coupon_id, ‘usage_limit_per_user’, ‘1’ ); // 1 use per customer
update_post_meta( $new_coupon_id, ‘expiry_date’, ‘2026-12-31’ );

return $new_coupon_id;
}

The discount_type meta key accepts three values: percent, fixed_cart, or fixed_product. Call this function on a hook relevant to your use case — for instance, on woocommerce_order_status_completed to issue a loyalty coupon automatically after every successful order.

WooCommerce programmatic coupon generation result showing the new coupon appearing in the Marketing Coupons list

For further reference on all available coupon meta keys, see the official WooCommerce coupon documentation.

Best WooCommerce Coupon Plugins (2026)

The built-in WooCommerce coupon system covers the basics well. These plugins extend it for advanced use cases: BOGO deals, role-based discounts, bulk generation, and more. Each is compatible with the latest version of WooCommerce as of 2026.

1. Advanced Coupons for WooCommerce

Advanced Coupons for WooCommerce

The most comprehensive coupon plugin available. Advanced Coupons adds BOGO deals, cart conditions (trigger coupons only when the cart meets specific criteria), coupon scheduling, loyalty programs, auto-apply rules, and URL coupons, all in one package.

If you’re running serious promotional campaigns and want to avoid writing custom PHP, this is the go-to plugin.

  • Use case: BOGO promotions, auto-apply cart conditions, loyalty programs
  • Pricing: Freemium (paid plans from ~$59/year)
  • Installs: 80,000+

2. WooCommerce Smart Coupons

WooCommerce Smart Coupons plugin interface showing gift certificate and store credit management

The official WooCommerce extension for advanced coupon workflows. Smart Coupons enables customers to buy store credits for themselves or gift them to others, generates unique coupon codes in bulk, supports coupon URLs, and allows one-click coupon redemption at checkout.

  • Use case: Store credits, gift certificates, bulk unique coupon generation
  • Pricing: $99/year (official WooCommerce extension)
  • Best for: Stores with loyalty programs or gift card functionality

3. Coupon Creator

Coupon Creator plugin showing visual coupon template editor in WordPress

A flexible coupon design plugin that lets you create visually styled coupon blocks either built with the plugin’s editor or uploaded as a custom image. Useful when you want to display printable coupons or styled coupon widgets directly on your storefront pages.

  • Use case: Visual/printable coupons, coupon widgets in posts or pages
  • Pricing: Free (pro from $49/year)
  • Installs: 10,000+

4. Coupon Generator for WooCommerce

Coupon Generator for WooCommerce plugin showing bulk coupon generation interface

Purpose-built for bulk coupon code generation. If you need to create thousands of single-use unique codes for a large email campaign or loyalty reward rollout, this plugin handles it efficiently. It’s been tested up to 1,000,000 coupons and works well even on budget hosting environments.

  • Use case: Mass generation of unique single-use codes
  • Pricing: Free
  • Installs: 8,000+

5. Coupon & Discount by User Role for WooCommerce

Coupon and Discount by User Role for WooCommerce plugin settings interface showing role-based discount configuration

Allows you to tailor coupon availability and discount amounts based on the customer’s WooCommerce user role.

You can restrict certain coupons to wholesale customers, hide the coupon field entirely for guest users, or automatically apply different discount percentages based on role, all without custom code.

  • Use case: Wholesale pricing tiers, VIP customer discounts, role-restricted promotions
  • Pricing: Freemium
  • Best for: B2B stores or membership-based pricing

How to Distribute Your Coupons

Creating the coupon is step one. Getting it in front of the right customer at the right moment is what actually drives conversions. Here are the most effective distribution channels in 2026.

Email Marketing

Email remains the highest-ROI distribution channel for coupons. Segment your list and send targeted offers: new subscriber welcome discounts, win-back campaigns for lapsed customers, or post-purchase loyalty codes.

Plugins like AutomateWoo and Mailchimp for WooCommerce let you automate this directly within your WooCommerce workflow, triggering coupon emails based on customer behavior without any manual effort.

Abandoned Cart Recovery

A time-limited coupon sent 1–2 hours after cart abandonment is one of the best-performing automations in e-commerce. Keep the discount modest (10–15% is usually sufficient to convert) and set a tight expiry of 24 to 48 hours to create urgency. AutomateWoo handles this sequence natively and integrates directly with WooCommerce order data.

URL-Based Sharing

Use the ?coupon_code=YOURCODE URL parameter to build pre-applied coupon links for social media posts, influencer partnerships, or paid ad landing pages. Customers land on your store with the discount already applied, eliminating the checkout friction of having to remember and enter a code.

Post-Purchase Loyalty Codes

Generating a unique coupon automatically after a completed order (using the programmatic method from the previous section) is an effective retention tactic. The discount gives customers a reason to return, and the timing (right after a successful purchase) is when sentiment toward your brand is at its peak. Pair this with a WooCommerce follow-up email for maximum impact.

Troubleshooting Common Coupon Issues

“Coupon does not exist” or “Coupon is not valid”

  • Verify the coupon is published (not in Draft status) under Marketing → Coupons.
  • Check that the expiry date hasn’t passed.
  • Confirm the coupon usage limit hasn’t been reached.
  • Make sure coupons are enabled in WooCommerce → Settings → General.

Coupon isn’t applying to the right products

  • Under Usage Restrictions, check the Products and Product Categories fields. If specific products are listed there, the coupon won’t apply to anything outside that list.
  • If “Exclude sale items” is checked, the coupon won’t apply to products currently on sale.

Free shipping coupon not working

The free shipping coupon requires a specific configuration step beyond the coupon itself. This catches a lot of store owners off guard the first time.

  1. Go to WooCommerce → Settings → Shipping.
  2. Click on your shipping zone and edit the Free Shipping method.
  3. Set “Free shipping requires” to “A valid free shipping coupon.”
  4. Save changes.

Without this, the free shipping coupon won’t override your standard shipping methods even if it’s applied correctly at checkout.

The coupon field isn’t showing at checkout

  • Confirm coupons are enabled in WooCommerce → Settings → General.
  • Some themes or page builders suppress the coupon field via a filter. Check for woocommerce_coupons_enabled hooks in your theme’s functions.php or any active checkout optimization plugins.
  • If you’re using a custom checkout plugin, check its documentation for a coupon field toggle.

Programmatically created coupon not applying via the hook

  • Make sure you’re using WC()->cart rather than the legacy $woocommerce->cart global — the global still works in most setups but is not the recommended pattern in WooCommerce 3.x+.
  • The coupon must exist as a published shop_coupon post before add_discount() is called. Create it first if it doesn’t exist yet.

WooCommerce cart page showing a coupon discount applied automatically, reducing the cart total

Conclusion

WooCommerce coupons are more capable than most store owners realize. The built-in UI now lives under Marketing → Coupons, gives you full control over discount types, restrictions, and usage limits. The PHP hooks let developers go much further with auto-apply logic and programmatic generation.

The key points to remember going into your next campaign: coupon codes are not case-sensitive, the free shipping coupon requires a separate shipping zone configuration, and for anything beyond basic promotions, plugins like Advanced Coupons or Smart Coupons close the gap quickly.

Need a fast, reliable environment to run your WooCommerce store? Cloudways managed hosting offers optimized stacks, automatic backups, and one-click staging environments so you can test your coupon campaigns before going live.

Host Your WooCommerce Store on Cloudways

Get blazing-fast performance for your WooCommerce store with Cloudways. Managed hosting, SSD-powered servers, and built-in caching — so your promotions convert, not crash.

Frequently Asked Questions

What is a WooCommerce coupon code?

A) A WooCommerce coupon code is an alphanumeric string that customers enter at cart or checkout to receive a discount, free shipping, or store credit. Store owners create and manage these under Marketing → Coupons in the WordPress dashboard. They’re one of the most effective tools for running promotions on a WooCommerce store.

Are WooCommerce coupon codes case-sensitive?

A) No. WooCommerce coupon codes are not case-sensitive. A code created as SAVE20 will work identically whether a customer types save20, Save20, or SAVE20 at checkout.

How do I disable a coupon without deleting it?

A) Open the coupon editor under Marketing → Coupons and change its status from Published to Draft. The coupon is preserved for future use but immediately stops working at checkout.

Can a customer use multiple coupons on one order?

A) By default, WooCommerce allows multiple coupons per order. You can prevent stacking by checking “Individual use only” in a coupon’s Usage Restrictions tab. If you allow multiple coupons, the “Calculate coupon discounts sequentially” setting in WooCommerce → Settings → General controls whether the second coupon applies to the original price or the already-discounted price.

How do I bulk-generate unique coupon codes?

A) Use the Coupon Generator for WooCommerce plugin (free) or WooCommerce Smart Coupons (paid). Both let you define a template — discount type, amount, expiry — and generate thousands of unique single-use codes in one batch, which you can then export as a CSV for email marketing campaigns.

How does a WooCommerce promo code work?

A) Once a coupon is published, customers see a coupon input field on the cart and checkout pages. They type or paste the code and click Apply. WooCommerce validates the code against its settings (expiry, usage limits, restrictions) and, if everything checks out, deducts the appropriate discount from the order total in real time.

Why isn’t my free shipping coupon working?

A) The free shipping coupon requires an extra step in your shipping configuration. Go to WooCommerce → Settings → Shipping, open your shipping zone, and edit the Free Shipping method. Set “Free shipping requires” to “A valid free shipping coupon.” Without this, WooCommerce won’t activate free shipping even when the coupon code is applied correctly at checkout.


Share your opinion in the comment section. COMMENT NOW

Share This Article

Zain Imran

Zain is an electronics engineer and an MBA who loves to delve deep into technologies to communicate the value they create for businesses. Interested in system architectures, optimizations, and technical documentation, he strives to offer unique insights to readers. Zain is a sports fan and loves indulging in app development as a hobby.

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour