HDWebmobile Coupon Links

By HDWebMobile

0+ active installationsVersion 1.0.0

Share links that add a coupon to the cart (saved until the cart qualifies), plus per-coupon cart conditions.

Description

HDWebmobile Coupon Links 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, contain a product from a specific category, hold at least N items, or reach a minimum subtotal. If a condition is not 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 append &hdcl_redirect=/shop/ to send them somewhere afterwards. If the cart doesn’t qualify yet — most people click a coupon link before they’ve added anything — the coupon is saved for that visitor and applied automatically as soon as their cart meets its conditions.

What makes it different

  • A coupon link is never wasted. When someone opens a link before their cart qualifies, the coupon is kept and applied by itself the moment the cart meets its rules, with a message telling them so. Expired or used-up coupons are still refused straight away.
  • Cart conditions that don’t limit the discount. Require a specific product or category to be in the cart, or a minimum number of items, while the coupon still discounts the whole order (for example “10% off everything when you buy a starter kit”).
  • No new admin screens to learn. Conditions live on WooCommerce’s own coupon edit screen, and a link is just your store URL plus the coupon code.
  • Free, with every feature included. There is no paid tier or upgrade.

Security by design

  • No free-text coupon fields. Conditions are edited only inside WooCommerce’s own coupon-data panel (behind the edit_shop_coupon capability and WooCommerce’s coupon nonce), and every stored value is a number (product IDs, category IDs, a count, a subtotal). A condition never produces output: it only yields “met / not met”, and the rejection message is built from translated strings and wc_price(), never from a stored value.
  • A coupon link can only ever apply an existing, published coupon. The hdcl_coupon value is normalised and looked up with WC_Coupon; if it does not resolve to a published coupon, nothing happens. The code is handed to WooCommerce’s own validation and apply_coupon(), so every usage rule (expiry, usage limits, minimum/maximum spend, allowed emails) plus the cart conditions above are still enforced — including for a saved coupon, which is re-validated before it is applied. There is no code path that creates a coupon, edits one, or sets a discount amount. The endpoint is also rate-limited per visitor, and any redirect target is passed through wp_validate_redirect() (same-site only).

Key Features

  • Per-coupon cart conditions: required product, required category, minimum item count, minimum subtotal
  • Conditions are 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
  • A link opened before the cart qualifies is saved and applied automatically once it does
  • 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

Enjoying this plugin?

If it helps your site, please consider leaving an honest review on WordPress.org — it helps other WordPress users find it. Found a problem or have an idea? Please open a support topic first so it can be fixed.

How to Use

1. Add conditions to a coupon

Go to Marketing > Coupons, edit a coupon, and in the General tab find “HDWebmobile cart conditions”. Set any combination of: a required product, a required category, a minimum item count, a minimum subtotal. Save the coupon.

2. Share an apply-by-link

Use https://yourstore.com/?hdcl_coupon=YOURCODE. When a visitor opens it, the coupon is applied to their cart (subject to all of WooCommerce’s usual rules).

Installation

  1. Upload the plugin files to the /wp-content/plugins/hdwebmobile-coupon-links directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the ‘Plugins’ screen in WordPress. WooCommerce must already be installed and active.
  3. See WooCommerce > HDWebmobile > Coupon Links & Conditions for a short how-to and the link format.

Screenshots

Changelog

1.0.0

  • Initial release: per-coupon cart conditions (product / category / item count / subtotal) and rate-limited apply-by-link URLs that only ever apply an existing published coupon. A link opened before the cart qualifies is saved and applied automatically once it does.