Auto-Apply Coupons to Cart (Pro)
The “copy-paste” dance is one of the biggest conversion killers in e-commerce: a visitor wins a code, copies it, keeps browsing, forgets it, then abandons the cart trying to find it again. The Auto-Apply Coupon feature removes that friction by pushing the winning code straight into the shopper’s WooCommerce session, so the discount is waiting for them when they reach the cart or checkout. This is a Pro-only feature (part of the separate Ultimate Spin Wheel Pro plugin) and requires WooCommerce to be active.
How It Works (The Technical Flow)
Auto-Apply is a coordinated handshake between the server and the browser. The plugin applies the code through several redundant paths so the discount survives redirects and guest sessions:
- The spin: When the server-side draw lands on a winning slice, it resolves the real coupon code (a Static code, a code pulled from a Unique Pool, or a Pro-generated code).
- Immediate server-side apply: During the spin request, if Auto-Apply is on and WooCommerce is active, the plugin ensures a customer session exists with
WC()->session->set_customer_session_cookie( true )and applies the code right away withWC()->cart->apply_coupon( $code ). - Browser fallback: The front end also drops a short-lived cookie (
uspw_apply_coupon, valid for one hour) as a backup, in case the shopper’s cart session was not fully established during the spin. - Redirect carry-over: If you set a Redirect URL, the win button appends the code as a
?uspw_coupon=query parameter to the destination, so the coupon travels with the visitor to the shop or checkout page. - The application: On the next page load, the plugin’s
wp_loadedhook reads the code from theuspw_coupon/couponURL parameter or the cookie, applies it withapply_coupon()if it is not already on the cart, recalculates totals, and clears the cookie. - The result: WooCommerce displays its standard “coupon applied” notice and the discount is reflected in the cart total.
Enabling Auto-Apply
Auto-Apply is a per-campaign setting, so you can turn it on for a cart-focused wheel and leave it off for an email-only one.
- Open your campaign and go to the Behavior tab.
- In the Outcome & Prize Delivery section, turn on the Auto-Apply Coupon toggle (marked Pro).
- Save the campaign. The setting takes effect on the front end immediately.
With Free, this toggle is visible but locked; enabling it prompts you to upgrade. Auto-Apply only runs when the Pro plugin is active.
Optional: Redirect After Win
In the same Outcome & Prize Delivery section there is a Redirect URL (Optional) field. It is a standard, free setting that sends the winner to any URL you choose (for example /shop) when they click the win button. Pairing a redirect to your shop with Auto-Apply is a strong combination: the shopper arrives on a shopping page with the discount already in place while the excitement is still high.
Dealing with Cache (Crucial)
The most common reason this feature appears to “fail” is aggressive server-side caching. If your host serves a cached version of the cart page, the dynamic PHP that applies the coupon may never run.
- The fix: Exclude your cart, checkout, and account pages from every caching layer (page cache, Varnish, Redis, WP Rocket, host-level cache). WooCommerce already flags these as non-cacheable, but custom caches sometimes override that.
- Verify with Incognito: Test a spin in a private/incognito window. If the coupon applies there but not in your normal session (or vice versa), a caching conflict is almost certainly the cause.
Interaction with Other Coupons
The plugin applies the won code through WooCommerce’s own apply_coupon() method, so all of WooCommerce’s normal coupon rules apply:
- If the cart already holds the same code, the plugin skips re-applying it (it checks
has_discount()first). - If your coupon has “Individual use only” enabled, WooCommerce may refuse to stack it alongside another coupon, exactly as it would for a manually entered code.
- Best practice: Enable “Individual use only” on your spin coupons so a visitor cannot stack a large spin win on top of an existing sitewide code.
Frequently Asked Questions
Does this work for guest users?
Yes. The plugin calls set_customer_session_cookie( true ) to make sure even a guest has a WooCommerce session, so the discount persists as long as they stay in the same browser.
How long does the auto-apply last?
Once applied, the coupon lives in the WooCommerce cart/session like any other applied coupon. The browser fallback cookie itself is short-lived (about one hour), and the coupon’s own expiry or usage limits still apply on top of that.
Does it work with AJAX “add to cart” buttons?
Yes. The coupon is applied to the session and cart, not to a specific page render, so items added later via AJAX will still show the discount when the cart totals recalculate.
Which coupon types can be auto-applied?
Any winning slice that resolves to a real code — a Static code, a Unique Pool code, or a Pro Auto Generate / WooCommerce Dynamic code. A “Lose (No Prize)” slice has no code, so there is nothing to apply.
What message does the customer see?
When the code is added, WooCommerce shows its own standard coupon-applied notice on the cart or checkout page. The plugin does not add a separate customizable “coupon applied” label.
Related Documentation
- Prize & Coupon Configuration: Set up Static codes, Unique Pools, and the Pro coupon types that Auto-Apply delivers.
- Win Probabilities: Control how often each coupon is won.
Conclusion
Auto-Apply Coupon (Pro) is the bridge between a lead and a sale. By dropping the winning code straight into the WooCommerce session — server-side, with a browser fallback and a redirect carry-over — it removes the manual copy-paste step and lifts your conversion rate. Just remember to exclude your cart and checkout pages from caching. If you need help, visit the wowDevs support center.