less than a minute read • Updated 40 minutes ago
Add a coupon automatically with a link or form
How to apply a Foxy coupon automatically through an add to cart link or form using the coupon parameter, so the customer doesn't have to enter a code.
You can apply an existing coupon automatically by adding the coupon parameter to a product's add to cart link or form. The customer does not have to type the code, and it applies once the order meets the coupon's requirements.
Create the coupon first (see Create a coupon), then use one of the methods below.
Using Link & Form Builder
Editing the link or form directly
Add coupon=CODE to the add to cart link or form.
Link example:
<a href="https://YOURSTORE.foxycart.com/cart?name=Flute+Swab&price=10&coupon=20OFF20">
Add to Cart
</a>Form example:
<input type="hidden" name="coupon" value="20OFF20" />To add more than one coupon at once, separate codes with commas: coupon=code1,code2,code3.
Notes
The coupon must already exist in the admin.
The
couponparameter does not need to be encrypted, even if you use add to cart link and form HMAC encryption.The discount only applies when the order matches the coupon's requirements.