Download Sample Code


In the previous example we built a checkout form that collected account, billing and shipping information, displayed order information and allowed customers to pay using their credit card or an offsite payment method like PayPal. In this example we'll extend that by adding form elements that allow the customer to apply a coupon to their order.

  1. The first thing we'll do is create a form section where we can put Form SmartTags related to coupons. Creating this form section is not required but is recommended. Doing this allows MemberMouse to only show the coupon section when coupons are active and available on your MemberMouse site. Using this example as a starting point you'll add the following below the shipping information section:


    [MM_Form_Section type="coupon"]
    <!-- all coupon Form SmartTags and design elements go here -->
    [/MM_Form_Section]

  2. Next, we'll add a form field and a button inside the coupon MM_Form_Section block so that the user can enter in a coupon code and apply in it to the order. Here's what you'll add:


    Coupon Code: [MM_Form_Field name="couponCode"]
    <a href="[MM_Form_Button type='applyCoupon']">Apply Coupon</a>

    Now the customer can enter in a coupon code in the couponCode form field and click the Apply Coupon button to apply it to the order.

  3. Next, we'll add a couple of form messages so that the user can be provided with feedback after applying a coupon. Here's what you'll add:


    [MM_Form_Message type="couponSuccess"]
    [MM_Form_Message type="couponError"]

     

    Now when the customer clicks the
    Apply Coupon button, MemberMouse will display a success or error message based on if the coupon code they entered was valid or not.



Coupon Support Example


Below is an example of what a coupon area will look like. Note: The "Apply Coupon" field will only show if there are active and available coupons.



Note: The form will look different depending on the theme you've chosen.