How to disable a specific product link (free product) in the cart

hamuq
Visitor
1 0 0

We are currently running a promotion offering a free item with the purchase of a specific product.

 

To facilitate this promotion, we are utilizing the Cartbot app. Consequently, when customers add the specified product to their cart, the complimentary item is automatically included.

 

However, we have encountered an issue where the link for the free product is clickable, leading customers to a new tab and potentially bypassing the intended process.

 

How can we disable this clickable link for the free product to ensure customers follow the correct procedure?

Replies 3 (3)

SymmetryMike
Shopify Partner
30 6 3

Hey Hamuq!

 

There are a few ways to accomplish this depending on how Cartbot is setup. I think the 2 that would be relevant are:

1. Unpublishing products from the online store. This hides them and they can still be added via API. If the CartBot app works that way than this should work. If not:

2. You can change the default theme template for the products that are for upsell only. Within the new template remove the ability to add to cart and just have it serve as an informational page about the product.

 

If you want to also add a post sale validation you can setup automations to look for these products in orders where the conditions aren't met and have them automatically cancelled.

 

Hope this helps!

Mike Kiss

@ symmetrycommerce.com we build integrations, websites and Shopify solutions.

Xipirons
Shopify Partner
136 24 30

Hi @hamuq 

 

To disable the clickable link for the free product added by the CartBot app in Shopify, you can follow these steps:

 

1. In your Shopify admin, go to Online Store > Themes.

2. Find the theme you are currently using and click on the Actions button. Select Edit code from the dropdown menu.

3. In the theme code editor, locate and open the file named cart-template.liquid. This file controls the layout and functionality of the cart page.

4. Look for the code that displays the product titles in the cart. It should look something like this:

 

<a href="{{ item.url }}">{{ item.product.title }}</a>



5. To disable the link for the free product, you can add a condition to check if the product is the one added by CartBot. Modify the code as follows:

 

{% if item.product.id == FREE_PRODUCT_ID %}
<span>{{ item.product.title }}</span>
{% else %}
<a href="{{ item.url }}">{{ item.product.title }}</a>
{% endif %}

Replace `FREE_PRODUCT_ID` with the actual ID of the free product added by CartBot. You can find the product ID by going to the product page in your Shopify admin and looking at the URL. The ID will be the number at the end of the URL.

 

6. Save the changes to the cart-template.liquid file.

7. The free product title should now appear as plain text without a clickable link in the cart

.

By adding this condition, the link will be disabled only for the specific free product added by CartBot, while other products in the cart will still have clickable links to their respective product pages.

Note: Make sure to replace `FREE_PRODUCT_ID` with the actual ID of your free product. Also, it's recommended to test this change thoroughly to ensure it works as expected and doesn't affect other functionality on the cart page.

 

Was this helpful? Like or Accept solution - Buy me a coffee
- Contact me: Xipirons | WhatsApp
- Shopify Developer based in France, helping online merchants succeed

EasifyApps
Shopify Partner
541 16 42

Hi @hamuq,

You might want to explore the Easify Product Options app, which allows you to seamlessly integrate add-on products with your main product while keeping them hidden from your storefront setting up seo.hidden metafield.

There are various methods for presenting your add-on products on the main product page. Here's an example utilizing the Checkbox option type 🤗:

  • Storefront:

EasifyApps_1-1712740937664.png

EasifyApps_2-1712740966085.png

 

  • App Settings:

EasifyApps_3-1712741004136.png

EASIFY - MAKING SHOPIFY SIMPLE & SWEET!
Easify Product Options: Create custom product options 10X faster & easier!
Easify Product Attachments: Effortlessly add downloadable PDF files (or any other format) to Shopify pages!
Try for Free | 24/7 Live Chat Support