Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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.
Solved! Go to the solution
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:
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
Hey @neelesh9979
Kindly share your Store URL and Password if enabled
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>
If I managed to help you then, don't forget to Like it and Mark it as Solution!
Best Regards,
Moeed
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:
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
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025