How to hide add to cart button from product page.

Solved

How to hide add to cart button from product page.

neelesh9979
Shopify Partner
2 0 0

Hello,

i want to hide add to cart button from product detail page beacuse i have multilocation wherehouses. if user visit my site from US country and inventry available my wherehouse so add to cart  button display on the site and if inventry is not available so add to cart button hide from product detail page.

Accepted Solution (1)

Cedcommerce
Shopify Partner
718 77 116

This is an accepted solution.

Hello @neelesh9979

 

Based on your query, we have checked your issue. We have framed a solution that will be helpful to you.

 

To hide the "Add to Cart" button on the product detail page based on the availability of inventory in different warehouses and the user's country, you can follow these steps:

 

  1. Log in to your Shopify admin panel.
  2. Go to the Online Store > Themes, > Actions > Edit code.

 

Now add this code in your Add to Cart button. 

{% if shop.country == 'United States' %} {% if product.available %} <!-- Add to Cart button code --> {% endif %} {% endif %}

 

This code checks if the user's country is the (shop.country == 'United States') and whether the product is available (product.available). 

Only if both conditions are met, the (Add to Cart) button code will be displayed.

 

The above code and steps is for representation purpose it may vary depending on your theme and the country you have warehouse's location. 

 

If you need more help with this, we are there. 

 

All the best, 

CedCommerce

CedCommerce || Shopify Expert
- Let us know if our reply is helpful for you. Like it.
- Was your question answered? Mark it as an accepted solution.
- For further discussion contact: Email ID- apps@cedcommerce.com
- Whatsapp:- Join Here

View solution in original post

Replies 4 (4)

Moeed
Shopify Partner
7110 1908 2342

Hey @neelesh9979 
Kindly share your Store URL and Password if enabled

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications


neelesh9979
Shopify Partner
2 0 0

Website url: https://urbancan.com/

password: upcan

Moeed
Shopify Partner
7110 1908 2342

Hey @neelesh9979 

Follow these Steps:

1) Go to Online Store
2) Edit Code
3) Find theme.liquid file
4) Add the following code in the bottom of the file above </body> tag.

<style>
.product-form__buttons {
    display: none !important;
}
</style>

Moeed_0-1686910313666.png

 

If I managed to help you then, don't forget to Like it and Mark it as Solution!

 

Best Regards,
Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications


Cedcommerce
Shopify Partner
718 77 116

This is an accepted solution.

Hello @neelesh9979

 

Based on your query, we have checked your issue. We have framed a solution that will be helpful to you.

 

To hide the "Add to Cart" button on the product detail page based on the availability of inventory in different warehouses and the user's country, you can follow these steps:

 

  1. Log in to your Shopify admin panel.
  2. Go to the Online Store > Themes, > Actions > Edit code.

 

Now add this code in your Add to Cart button. 

{% if shop.country == 'United States' %} {% if product.available %} <!-- Add to Cart button code --> {% endif %} {% endif %}

 

This code checks if the user's country is the (shop.country == 'United States') and whether the product is available (product.available). 

Only if both conditions are met, the (Add to Cart) button code will be displayed.

 

The above code and steps is for representation purpose it may vary depending on your theme and the country you have warehouse's location. 

 

If you need more help with this, we are there. 

 

All the best, 

CedCommerce

CedCommerce || Shopify Expert
- Let us know if our reply is helpful for you. Like it.
- Was your question answered? Mark it as an accepted solution.
- For further discussion contact: Email ID- apps@cedcommerce.com
- Whatsapp:- Join Here