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.
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:
Log in to your Shopify admin panel.
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.