It's Easy to Integrate Coupon Codes - June 25, 2009
Following up with yesterday's lesson on setting up coupon codes, today we'll show you the code to accept coupon codes. Once you've set up your Coupon Code in the backend, all you need to do is add a simple code snippet to your store's page:
<v:store:if_discount>
Special Offer code applied.
<v:else>
<v:store:discount>
If you have a Special Offer Code, enter it here and click Apply: <v:text_field name="discount" />
<input type="submit" value="Apply" />
</v:store:discount>
</v:else>
</v:store:if_discount>
We used the <v:store:if_discount> and <v:store:discount> tags to allow the user to input a coupon code. Lets see how this renders:
After entering our 2buxoff coupon code (that we created yesterday), we can see the discount is reflected in the total: