Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi all,
I used the below script to remove the price when it is equal to 0, it works fine, however, i want to hide the add to cart and pay now in Debut, can anyone help?
<script>
function hidePrices(){
var prices = document.querySelectorAll('.price-item--regular');
if (!prices){return;}
for (var each of prices)
{ var price=each.textContent.trim();
if (price == '$0.00') {
each.closest('.price').remove();
}
}
}
hidePrices();
</script>
Solved! Go to the solution
This is an accepted solution.
Hi @JCJackie
In order to fulfill your request, please follow these steps
Step 1: Go to Shopify Admin -> Online Store ->Theme -> Edit code
Step 2: Search file theme.liquid
Step 3: Insert this code above </head>
{% if product.price == 0 %}
{% style %}
form.product-form.product-form-product-template.product-form--payment-button-no-variants {
display: none !important;
}
{% endstyle %}
{% endif %}
I hope this helps
Best,
Daisy
Hey @JCJackie
Welcome to Shopify Community! Can you share your Store URL so I can have a look on it? Also, if you have password enabled then please share the password as well. Your cooperation would be greatly appreciated.
Best Regards,
Moeed
https://www.theukulelestore.hk/en/products/give-thanks-%E5%85%8D%E8%B2%BBukulele-chord%E8%AD%9C
thanks @Moeed i have removed the price, but also want to remove the "buy it now" and "add to cart" button
Hey @JCJackie
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 {
display: none !important;
}
</style>
RESULT:
If I managed to help you then, don't forget to Like it and Mark it as Solution!
Best Regards,
Moeed
@Moeed i only want it to be hide when the price is 0 (which i already hide the price), and the button should be showing when the price is > 0
This is an accepted solution.
Hi @JCJackie
In order to fulfill your request, please follow these steps
Step 1: Go to Shopify Admin -> Online Store ->Theme -> Edit code
Step 2: Search file theme.liquid
Step 3: Insert this code above </head>
{% if product.price == 0 %}
{% style %}
form.product-form.product-form-product-template.product-form--payment-button-no-variants {
display: none !important;
}
{% endstyle %}
{% endif %}
I hope this helps
Best,
Daisy
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024