HDWebmobile Coupon Links & Conditions

HDWebmobile Coupon Links & Conditions banner

HDWebmobile Coupon Links & Conditions

Cart-condition coupons and apply-by-link URLs — a coupon link only ever applies an existing published coupon by exact code, and coupon conditions are edited only on the coupon screen.

Overview

HDWebmobile Coupon Links & Conditions adds two things to WooCommerce’s own coupons. Cart conditions: on any coupon’s edit screen you can require the cart to contain a specific product, a product from a specific category, at least N items, or a minimum subtotal — if a condition isn’t met, the coupon is rejected at apply time with a clear message. Apply-by-link: share a URL like https://yourstore.com/?hdcl_coupon=SUMMER10 and the coupon is added to the visitor’s cart automatically, optionally followed by a redirect.

“Advanced Coupons for WooCommerce” (up to and including 4.7.1.1) shipped a stored Cross-Site Scripting vulnerability where a value saved against a coupon was later rendered to storefront visitors without escaping. This plugin closes that class of bug by construction: conditions are edited only inside WooCommerce’s own coupon-data panel (behind the edit_shop_coupon capability and WooCommerce’s coupon nonce), every stored value is a number (product IDs, category IDs, a count, a subtotal — there is no free-text condition field at all), and a condition never produces output; it only yields “met / not met.” A coupon link can only ever apply an existing, published coupon — the code is normalised and looked up with WC_Coupon, and handed straight to WooCommerce’s own apply_coupon(), so every usage rule (expiry, usage limits, spend limits, allowed emails) is still enforced. There is no code path that creates or edits a coupon or sets a discount amount. The endpoint is rate-limited per visitor, and any redirect target passes through wp_validate_redirect() (same-site only).

Key Features

  • Per-coupon cart conditions: required product, required category, minimum item count, minimum subtotal
  • Conditions enforced through WooCommerce’s own coupon-validation hook, with clear shopper-facing messages
  • Apply-by-link URLs for any published coupon, with an optional same-site redirect
  • No settings to save and no database table — conditions live on the coupon, the link is just a URL
  • Works with WooCommerce’s classic and block-based Cart and Checkout

Limitations

Please read before installing:

  • Conditions are per-coupon — no global “apply to all coupons” rule set
  • Apply-by-link requires the coupon to already be published and valid; it never creates one

Quick Setup

  1. Upload the plugin files to the /wp-content/plugins/hdwebmobile-coupon-links directory, or install through the Plugins screen directly.
  2. Activate the plugin through the ‘Plugins’ screen in WordPress. WooCommerce must already be installed and active.
  3. Edit any coupon, set your cart conditions on its edit screen, and share ?hdcl_coupon=YOURCODE links as needed.

Latest Version

Current stable version in readme: 1.0.0 (Initial release: per-coupon cart conditions, apply-by-link URLs, rate-limited and same-site-only redirects.)

See our other WordPress plugins for more WooCommerce and site-utility tools.


Ready to start your project?

Share your brief and we’ll propose the right approach — a full site, a landing page, or a custom plugin.