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

4 comments
  • Hi,

    I've got this up and running on my site and it's great, thank you! One question I do have is would it be possible to add a similar function to the cart code for the Bold Recurring Orders & Subscriptions for Shopify app?

    I've set up a similar discount code through the app itself on my store and would like a way for it to also auto-populate in the discount field for any qualifying customers, if possible?

    Thanks for your time,
    Mark

    0
    Comment actions Permalink
  • Hi Mark,

    Great question! I've discussed this with our Subscriptions app specialists and at the moment, this is not possible with the current functionalities of the app.

    This is currently only available on Cashier because it requires the discount codes to be made in Shopify. Which is why you needed to enable the Shopify Discount Connector within the Cashier app as well.

    However I am more than happy to send this in as a Feature Request to the Subscriptions team!

    Cheers,

    Melody
    Merchant Success Specialist

    0
    Comment actions Permalink
  • Hi Melody,

    If you could send it in as a Feature Request that'd be great. I'm sure it would benefit a lot of people if there's a way to make it work as it does for the standard Cashier app.

    Thanks,
    Mark

    0
    Comment actions Permalink
  • Hey Mark!

    I've gone ahead and passed this along to our development team. While unfortunately we're not able to guarantee when, or if this will be included as a feature, we're more than happy to pass this along!

    The more customers who request this, the more likely it is our development team will work to add it into the app.

    Cheers,
    Brendin
    Knowledge Centre Manager

    0
    Comment actions Permalink

Please sign in to leave a comment.