Using a Promocode for Product
Support avatar
Written by Support
Updated over a week ago

August 02, 2011
Updated: March 1, 2020

Below is an example of how you can add product promo codes easily within your web forms that you download from Platform for each campaign. This code can be applied to any multi-product campaign that you build within Platform.
 To integrate this into your web form code, you will need to first create a multi-product campaign, with the regular price product and the discounted product(s) that you would like to use as an incentive strategy. The discounted product will have the price that your customers receive when they enter the correct promo code that you provide them.
 Once you have created the discounted product(s) you can easily add the code below into your web forms. If you are creating a one page campaign then you will add this piece of code on page one; if you are creating a two page campaign then you will add it to your page two. Use the rule that you will always be adding this piece of code on your billing page wherever it applies. You can paste it anywhere you prefer on the page, we recommend you paste it wherever you want the promo code text box and button to appear on your page. Once pasted, you will need to adjust some fields to tailor it to your campaign.
 1) Adjust the "PROMOCODE" fields to be whatever you want your consumer to insert for the promo code to receive the discounted product. Example: DIET2010. This field will not be case sensitive and will accept it either way the customers submit it. This will be paired with a product id that will be activated when this code is entered. In the example code below we have offered two separate promotions: PROMOCODE will activate product 6, whereas PROMOCODE2 will activate product 7. You are not required to use more than one promo code.
 2) Adjust the number associated with the code to your discounted product id which is within Platform that you have created. Note that this product id must exist on this campaign. The correct format for the code/product id pair is a JSON object with the promo code as the key, and the product id as the value: {'PROMOCODE' : 6, 'PROMOCODE2' : 7}
 3) Hide the discounted products so they cannot be selected normally. Each product is enclosed in a div with id=”div_product_x,” where x is the product id. (Note: if your products do not have this wrapper, ensure you have the latest webforms downloaded for your campaign). Add the following attribute to this div tag:

<div id="div_product_6" style="display:none;"><input type="radio" value="0.5000" name="extra" id="product_6" onclick="change_products(0.50,6)" >Dollar Coffee (promo)</div>

 Once these have been adjusted, you should be able to execute this page and type in your promo code in upper case letters or lower case letters, and it will select the discounted product and adjust the price for you once applied.
 Here is the code:

<div id ="div_product_promo">
 <input size="6" name="product_promo" id="product_promo"/>&nbsp;
 <input value="Apply" onclick="CheckProductCode(1,{'PROMOCODE' : 6, 'PROMOCODE2' : 7});" type="button"/>
Did this answer your question?