How can I add a promotional text to my cart page?

Hello!

I believe you cannot give a free gift and use a coupon code. What I am working on now is in my cart, I want it to say, “Use coupon code: “GIFT” to receive our Matcha Mud Mask absolutely FREE.” below the item title. I have been working in this for a while and any help would be beneficial. I have circled in the pic below where I need this placement. Thanks

Hi @BobbyJ to implement this follow the below steps-

  1. Go to Online Store

  2. Edit Code

  3. Find and open cart-template, main-cart or whatever cart file code your theme have

  4. find for the “{{ line_item.product.title }}” below it just paste the below code-

{% if line_item.product.title == 'Matcha Mud Mask' %}
                              

Use coupon code: “GIFT” to receive our Matcha Mud Mask absolutely FREE.

                            {% endif %}
  1. Save it and check!

I tried and it will look like this-

Please let me know when works and mark as solve!

Hi @BobbyJ ,

To achieve this you first need to create a metafield, to create metafield you can follow these steps

1- Goto setting and then goto custom data

then click on product,

Add definition ,

Goto the product and goto the below and add these text,

And select the main-cart-items.liquid file,

and add the liquid code

{{ item.product.metafields.custom.content }}

Hello @BobbyJ ,

To add the text “Use coupon code: GIFT to receive our Matcha Mud Mask absolutely FREE” below the item title in your Shopify store, you will need to modify your theme’s code.

Please follow these steps to achieve the same:

Go to Shopify admin > Online Store > Themes.

Find the theme you’re currently using and click on Actions > Edit Code.

Now Locate the template file responsible for displaying the cart page. This file is usually named cart.liquid or cart-template.liquid. If you’re not sure, you can search for the code snippet or consult your theme’s documentation.

Within the template file, find the section where the item title is displayed. It might look something like:

{{ item.title }}

Just below that line, add the following code:

Use coupon code: 'GIFT' to receive our Matcha Mud Mask absolutely FREE

This code checks if the item’s price is zero (indicating it’s a free gift) and displays the promotional text accordingly.

Save the changes and preview your cart page to ensure the text is displaying as expected.

We advise you that If you are not experienced with liquid code or Shopify theme, please consider hiring a Shopify expert or a experienced developer who can help you with it.

Hope it helps. Let us know if you need any more help with your store.

Regards,

CedCommerce

I went through multiple cart options on my code and I was unable to find {{ line_item.product.title }

Thank you. This did work. Is there a way to bold the text as well?

To make the text bold you just need to wrap the text like this your text here

If it works, don’t forget to Like it and Mark it as Solution

Thanks. One last thing, if I wanted to change the color of the text to #e3838d, is that possible?

Yes, you can do this using style attribute like mentioned below
your text here