Automatically Apply a Discount From the Cart Page

Follow

Bold Cashier has the ability to use discount codes that are created within Shopify. You're able to make a small adjustment in your theme coding to automatically apply these discount codes from the cart page.

Note: You must have the Shopify Discount Connector installed and enabled on your store for this feature to work.

To automatically apply a discount code from the cart page, please follow these steps:

To apply a discount code with no conditions, please follow these steps:

  1. Create Your Discount Code.

    Note: You will need to record your discount code for Step 8 of this guide.

  2. From Shopify's admin, select Online Store.

    Select Online Store

  3. Select Actions.

    Select Actions

  4. Select Edit code.

    Select Edit Code

  5. Under "Templates", select cart.liquid.

    Note: The contents for this file may be located under "Sections" in cart-template.liquid.

    Select cart.liquid

  6. Find the line of code containing:
    <form action="/cart"

    Find form action=cart

  7. Copy and paste the following code below this line:
    <input type="hidden" name="discount" value="{{ discount_name }}"/>

    Paste input code

  8. Change {{ discount_name }} to the name of your discount code created in Step 1.

    Note: The braces need to be removed when entering your discount code name. This will not work if the braces are kept in the code.

    Change {{ discount_name }}

  9. Select Save.

    Select Save

That's it!

To apply a discount code with conditions, please follow these steps:

  1. Create Your Discount Code.

    Note: You will need to record your discount code for Step 8 of this guide.

  2. From Shopify's admin, select Online Store.

    Select Online Store

  3. Select Actions.

    Select Actions

  4. Select Edit code.

    Select Edit Code

  5. Under "Templates", select cart.liquid.

    Note: The contents for this file may be located under "Sections" in cart-template.liquid.

    Select cart.liquid

  6. Find the line of code containing:
    <form action="/cart"

    Find form action=cart

  7. Copy and paste the following code below this line:
    <input type="hidden" name="discount" value="{{ discount_name }}"/>

    Paste input code

  8. Change {{ discount_name }} to the name of your discount code created in Step 1.

    Note: The braces need to be removed when entering your discount code name. This will not work if the braces are kept in the code.

    Change {{ discount_name }}

  9. Copy and paste these two lines of code around the previous line (optional):

    Note: This is required if you only want to apply the discount code for customers with a specific tag or cart total.

    {% if customer.tags contains "VIP" or cart.total_price > 10000 %}
    <input type="hidden" name="discount" value"{{ discount_name }}"/>
    {% endif %}

    Wrap Code

  10. Change "VIP" and > 10000 to your customer tag and cart conditions (optional).

    Note: Visit Logical and comparison operators and Control flow tags (links to Shopify) for more information on how to change these conditions.

    Change Conditions

  11. Select Save.

    Select Save

That's it!

Next Steps:

Blog Posts:

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.