Shopify themes, liquid, logos, and UX
Hi! I have collection pages of items I'd like to sell, and collection pages of items that are sold, but that I want to display. I'd like to hide the prices for ONLY the products priced at $0, on the collections pages AND product pages. I have found many solutions across the web, but none of them have worked. The only thing I have successfully done is hide ALL product prices. I'm using the minimal theme with many adjustments already made. Please help! My launch is tomorrow! Thank you very much!
Solved! Go to the solution
This is an accepted solution.
This is an accepted solution.
@auroradreamsco You can query the product object for anything over $0 https://shopify.dev/docs/themes/liquid/reference/objects/product#product-price
{% if product.price >= 0 %}
*SHOW PRODUCT PRICE*
{% endif %}
in the minimal theme you'll find the relevant code in product-grid-item.liquid
Worth noting, I'm assuming what you're doing is selling 1 off products, then once sold reducing price to 0 so they may remain on your store but not be sold.
if that is the case i would suggest you use the product.available object and make use of Shopify inventory management, this will mean you don't have to change the prices of your products and prevent them from being purchased
{% if product.available %}
*SHOW PRICE*
{% endif %}
thank you for the quick reply! where is the correct place to insert this?
@auroradreamsco - the code will need to be added to collection and product page
if you are not familiar wit coding then you can add me to staff, I will do it
i have basic experience with the coding, if you let me know exactly which .liquids to add to, i should be good 🙂
it can be if it is used to show all the products
sorry, i don't understand. do i need to add the above snippet to product/collection pages in order to hide the prices of the products that aren't technically available/$0?
or do i need to adjust an already existing code?
This is an accepted solution.
okay i would like to use this solution:
if that is the case i would suggest you use the product.available object and make use of Shopify inventory management, this will mean you don't have to change the prices of your products and prevent them from being purchased
{% if product.available %} *SHOW PRICE* {% endif %}
do i change this in product-grid-item.liquid? and what does the line originally say?
what information do you need to log in and help ?
Suyash i sent you the invite. Hoping i can get this fixed today
This is an accepted solution.
AMAZING I'm am so so grateful thank you!!! Do you know if its possible to make the product pages for the $0 items to ONLY show a photo, title, and description?
bump!
@auroradreamsco - hello, on which page do you want only that content? can you send me page link?
Hi there
May I ask you to do something similar for me? I would like to hide the price on the product pages of a very specific collection.
@auroradreamsco as you are using the Minimal theme you will need to edit the product-grid-item.liquid as mentioned earlier.
the price is displayed with the {{ price }} is at the bottom of the code ( line 90 )
{% if on_sale %}
<span class="visually-hidden">{{ 'products.product.sale_price' | t }}</span>
{% else %}
<span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
{% endif %}
{{ price }}
{%- assign variant = featured.selected_or_first_available_variant -%}
you will apply the code to the {{ price }} so your code will look like the following
{% if on_sale %}
<span class="visually-hidden">{{ 'products.product.sale_price' | t }}</span>
{% else %}
<span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
{% endif %}
{% if product.available %}
{{ price }}
{% endif %}
{%- assign variant = featured.selected_or_first_available_variant -%}
If this helps you achieve your goal please mark this a solution to help others searching the community.
Unfortunately Clarke this did not work for me. I still see the $0 on the collections pages on those items that do not have prices, inventory, skus, or anything.
Is there a version of this that works for Studio Theme?
thanks
@pfrunz - it will need code editing , but it can be done
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