How to hide add to cart button from product page

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.

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

Website url: https://urbancan.com/

password: upcan

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 tag.

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

Best Regards,
Moeed

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 %} {% 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