Solsec
October 28, 2024, 1:45am
1
So a developer helped me code parts of my website and removed the price underneath my products at my request. I wanted to see if I could get some help in reimplementing the price since I no longer have access to the Brooklyn theme’s original coding since Shopify has removed the theme some years ago. Thanks!
My website: https://poisonjam.co/
Hello.
I just checked your store and your concern
Your store seems need new update because it isn’t updated for a long time.
Anyway, first of all, I can assist you to put price underneath your products
Add the following code below the product title:
{% if product.compare_at_price > product.price %}
{{ product.compare_at_price | money }}
{{ product.price | money }}
{% else %}
{{ product.price | money }}
{% endif %}
Updated code:
{{ product.title }}
{% if product.compare_at_price > product.price %}
{{ product.compare_at_price | money }}
{{ product.price | money }}
{% else %}
{{ product.price | money }}
{% endif %}
{% if sold_out %}
{{ 'products.product.sold_out' | t }}
{% endif %}
{% if product.price_varies == false and variant.unit_price_measurement != null %}
{% capture unit_price_separator %}
{{ 'general.accessibility.unit_price_separator' | t }}
{% endcapture %}
{% capture unit_price_base_unit %}
{% if variant.unit_price_measurement.reference_value != 1 %}
{{ variant.unit_price_measurement.reference_value }}
{% endif %}
{{ variant.unit_price_measurement.reference_unit }}
{% endcapture %}
{{ 'products.general.unit_price' | t }}
{{ variant.unit_price | money }}{{ unit_price_separator }}{{ unit_price_base_unit }}
{% endif %}
1 Like
Solsec
October 28, 2024, 10:01pm
4
Thank you! This works great. Can you write the code where it also hides the price on “sold out” items?
1 Like
Spac-es
October 29, 2024, 10:10am
5
Of course!
{{ product.title }}
{% unless product.available %}
{{ 'products.product.sold_out' | t }}
{% endunless %}
{% if product.available %}
{% if product.compare_at_price > product.price %}
{{ product.compare_at_price | money }}
{{ product.price | money }}
{% else %}
{{ product.price | money }}
{% endif %}
{% if product.price_varies == false and variant.unit_price_measurement != null %}
{% capture unit_price_separator %}
{{ 'general.accessibility.unit_price_separator' | t }}
{% endcapture %}
{% capture unit_price_base_unit %}
{% if variant.unit_price_measurement.reference_value != 1 %}
{{ variant.unit_price_measurement.reference_value }}
{% endif %}
{{ variant.unit_price_measurement.reference_unit }}
{% endcapture %}
{{ 'products.general.unit_price' | t }}
{{ variant.unit_price | money }}{{ unit_price_separator }}{{ unit_price_base_unit }}
{% endif %}
{% endif %}
1 Like