Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello Everyone
I have a website called https://allseasonamericanflooring.com if you check the products. I have added per unit pricing in both collections and product pages. Here is the code for it
<div class="grid-product__price">
{%- if on_sale -%}
<span class="visually-hidden">{{ 'products.general.regular_price' | t }}</span>
<span class="grid-product__price--original">{{ product.compare_at_price | divided_by:pcs_per_box | money }}/{{ price_uom }}</span>
<span class="visually-hidden">{{ 'products.general.sale_price' | t }}</span>
{%- endif -%}
{%- if product.price_varies -%}
{%- assign price = product.price_min | money -%}
<span {% if on_sale %}class="sale-price"{% endif %}>
{{ 'products.general.from_text_html' | t: price: price }}
</span>
{%- else -%}
<span {% if on_sale %}class="sale-price"{% endif %}>
{{ current_variant.price | divided_by:pcs_per_box | money }}/{{ price_uom }}
</span>
{%- endif -%}{%- assign product_variant = product.selected_or_first_available_variant -%}
{%- if product_variant.unit_price_measurement -%}
<div class="product__unit-price">
{%- capture unit_price_base_unit -%}
{%- if product_variant.unit_price_measurement -%}
{%- if product_variant.unit_price_measurement.reference_value != 1 -%}
{{ product_variant.unit_price_measurement.reference_value }}
{%- endif -%}
{{ product_variant.unit_price_measurement.reference_unit }}
{%- endif -%}
{%- endcapture -%}{{ product_variant.unit_price | divided_by:pcs_per_box | money }}/{{ unit_price_base_unit }}{{ price_uom }}
</div>
{%- endif -%}
I would like to change this divided by pcs into a metafield where we are already adding the per unit price. I want this called using that variant metafield which I have created. I tried doing it but I am
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