How can I remove the cart button for a specific product on my site?

I have a product (command post and platform) I want to apply an add ons via an app called upsell. I have created a new product (slide) and the developers of UpSell have guided me through how to add the slide to the command post and paltform as an add on. I have successfully done this but the UpSell developers have recommended I remove the cart button on the slide to prevent customers from buying this separately as the slide is not sold separately it is only available to buy with the command post and platform. I have been told I need a code to achieve this - PLEASE NOTE this is to be applied to this specific product (slide) and not all products on the store.

I also have two more add ons for the above product, top coat (painted) and assembly service (assemble and installation) as these are services I have been advised by Shopify agent that to ensure the services are only visible as an add-ons for specific products, I can utilize product tags and conditional logic within my theme’s code-- By assigning a unique tag to the products, I can then adjust the code to display the services only when that specific tag is detected. This modification involves editing my theme’s code. That’s why they have suggested posting this request in the Community, so you can provide the appropriate code.

Please help!

1 Like

Dawn theme,

Within the product template, locate the code that generates the “Add to Cart” button. It typically looks like this:


You’ll want to add a conditional statement that checks for the product you want to hide the button for. Let’s assume you want to hide the button for a product with a specific handle. You can add a condition like this:

{% if product.handle != "2022-fashion-mens-watch" %}

{% endif %}

I have gone to Themes, Customise, Product Template.. now where do I go to
find the code?

Once I have found the code that shows “product submit button” would I add
my conditional statement to the bottom of the codes? Would I just need to
amend the product handle as per below?

{% if product.handle != “The-Command-Post-&-Platform-With-Slide” %}
id=“ProductSubmitButton-{{ section_id }}” type=“submit” name=“add”
class=“product-form__submit button button–full-width {% if
show_dynamic_checkout %}button–secondary{% else %}button–primary{% endif
%}” {% if product.selected_or_first_available_variant.available == false or
quantity_rule_soldout %} disabled {% endif %} > {%- if
product.selected_or_first_available_variant.available == false or
quantity_rule_soldout -%} {{ ‘products.product.sold_out’ | t }} {%- else
-%} {{ ‘products.product.add_to_cart’ | t }} {%- endif -%}

class=“loading-overlay__spinner hidden”>
focusable=“false” class=“spinner” viewBox=“0 0 66 66” xmlns="
http://www.w3.org/2000/svg" >
stroke-width=“6” cx=“33” cy=“33” r=“30”>

{% endif %}

I have gone to Themes, Customise, Product Template.. now where do I go to find the code?

Once I have found the code that shows “product submit button” would I add my conditional statement to the bottom of the codes? Would I just need to amend the product handle as per below?

{% if product.handle != “The-Command-Post-&-Platform-With-Slide” %} <button id=“ProductSubmitButton-{{ section_id }}” type=“submit” name=“add” class=“product-form__submit button button–full-width {% if show_dynamic_checkout %}button–secondary{% else %}button–primary{% endif %}” {% if product.selected_or_first_available_variant.available == false or quantity_rule_soldout %} disabled {% endif %} > {%- if product.selected_or_first_available_variant.available == false or quantity_rule_soldout -%} {{ ‘products.product.sold_out’ | t }} {%- else -%} {{ ‘products.product.add_to_cart’ | t }} {%- endif -%}

{% endif %}

Hello @THEGARDENMARKET

Which theme you are using.

I am using theme:

Dawn - V1

Try to rewrite it {% if product.handle != “The-Command-Post-&-Platform-With-Slide” %}
<button id=“ProductSubmitButton-{{ section_id }}” type=“submit” name=“add” class=“product-form__submit button button–full-width {% if show_dynamic_checkout %}button–secondary{% else %}button–primary{% endif %}” {% if product.selected_or_first_available_variant.available == false or quantity_rule_soldout %} disabled {% endif %} >

{% endif %}