first commit
This commit is contained in:
2561
sections/product.liquid
Normal file
2561
sections/product.liquid
Normal file
File diff suppressed because it is too large
Load Diff
74
snippets/product-grid-price.liquid
Normal file
74
snippets/product-grid-price.liquid
Normal file
@@ -0,0 +1,74 @@
|
||||
{% comment %}
|
||||
Renders Price on product grid item
|
||||
|
||||
Accepts:
|
||||
- product: {Object} product (required)
|
||||
- current_variabt: {Object} Current variant (required)
|
||||
|
||||
Usage:
|
||||
{% render 'product-grid-price', product: product, current_variant: current_variant %}
|
||||
{% endcomment %}
|
||||
|
||||
{%- liquid
|
||||
|
||||
assign product_price = product.metafields.app--168074346497.min_auto_discounted_price.value | default: product.price
|
||||
assign product_price_min = product_price
|
||||
assign product_compare_at_price = product.compare_at_price
|
||||
assign product_compare_at_price_min = product.compare_at_price_min
|
||||
|
||||
if product_price < product.price and product_compare_at_price == 0 or product_compare_at_price == blank
|
||||
assign product_compare_at_price = product.price
|
||||
endif
|
||||
|
||||
if product_price < product.price and product_compare_at_price_min == 0 or product_compare_at_price_min == blank
|
||||
assign product_compare_at_price_min = product.price
|
||||
endif
|
||||
|
||||
assign product_price_raw = product_price
|
||||
assign product_price_min_raw = product_price_min
|
||||
assign product_compare_at_price_raw = product_compare_at_price
|
||||
assign product_compare_at_price_min_raw = product_compare_at_price_min
|
||||
|
||||
if settings.currency_code_enable
|
||||
assign product_price_min = product_price_min_raw | money_with_currency
|
||||
assign product_compare_at_price = product_compare_at_price_raw | money_with_currency
|
||||
else
|
||||
assign product_price_min = product_price_min_raw | money
|
||||
assign product_compare_at_price = product_compare_at_price_raw | money
|
||||
endif
|
||||
-%}
|
||||
|
||||
<span class="price{% if product_compare_at_price_raw > product_price_raw %} sale{% endif %}">
|
||||
{% if product.available or badge_soldout != '' %}
|
||||
<span class="new-price">
|
||||
{% if product.price_varies %}
|
||||
<small>{{ 'products.general.from' | t }}</small>
|
||||
{% endif %}
|
||||
{%- if product_price_raw == 0 and product.price_varies == false -%}
|
||||
{{ 'general.money.free' | t }}
|
||||
{%- else -%}
|
||||
{{ product_price_min }}
|
||||
{%- endif -%}
|
||||
</span>
|
||||
{% if product_compare_at_price_raw > product_price_raw %}
|
||||
<span class="old-price">{{ product_compare_at_price }}</span>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<span class="sold-out">{{ 'products.product.sold_out' | t }}</span>
|
||||
{% endif %}
|
||||
</span>
|
||||
{% if current_variant.unit_price %}
|
||||
{% capture unit_price_separator %}
|
||||
<span aria-hidden="true">/</span>
|
||||
<span class="visually-hidden">{{ 'general.accessibility.unit_price_separator' | t }} </span>
|
||||
{% endcapture %}
|
||||
{% capture unit_price_base_unit %}
|
||||
{% if current_variant.unit_price_measurement.reference_value != 1 %}
|
||||
{{ current_variant.unit_price_measurement.reference_value }}
|
||||
{% endif %}
|
||||
{{ current_variant.unit_price_measurement.reference_unit }}
|
||||
{% endcapture %}
|
||||
<br>
|
||||
<span class="visually-hidden visually-hidden--inline">{{ 'products.product.unit_price_label' | t }}</span>
|
||||
<span class="unit small">{% if settings.currency_code_enable %}{{ current_variant.unit_price | money_with_currency }}{% else %}{{ current_variant.unit_price | money }}{% endif %}{{ unit_price_separator }}{{ unit_price_base_unit }}</span>
|
||||
{% endif %}
|
||||
181
snippets/product-price.liquid
Normal file
181
snippets/product-price.liquid
Normal file
@@ -0,0 +1,181 @@
|
||||
{%- liquid
|
||||
assign current_variant = product.selected_or_first_available_variant
|
||||
assign price_font_size = block.settings.text_font_size
|
||||
|
||||
# start - Yagi discounted price calculation
|
||||
assign current_variant_price = selected_variant.metafields.app--168074346497.auto_discounted_price.value | default: current_variant.price
|
||||
|
||||
if current_variant_price < current_variant.price
|
||||
assign current_variant_compare_at_price = current_variant.price
|
||||
endif
|
||||
|
||||
if current_variant.metafields.app--168074346497.discount_type.value != nil and current_variant.metafields.app--168074346497.discount_type.value != "fixed"
|
||||
assign deducted_percentage = 1.0 | minus: product.metafields.app--168074346497.discount_percentage.value
|
||||
|
||||
if current_variant.metafields.app--168074346497.discount_percentage.value > 0.01
|
||||
assign deducted_percentage = 1.0 | minus: selected_variant.metafields.app--168074346497.discount_percentage.value
|
||||
endif
|
||||
|
||||
assign current_variant_price = current_variant.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil
|
||||
|
||||
assign current_variant_compare_at_price = current_variant.price
|
||||
|
||||
if current_variant.compare_at_price > current_variant_compare_at_price
|
||||
assign current_variant_compare_at_price = current_variant.compare_at_price
|
||||
endif
|
||||
endif
|
||||
|
||||
assign product_price = product.price
|
||||
assign product_compare_at_price_max = product.compare_at_price_max
|
||||
assign product_compare_at_price = product.compare_at_price
|
||||
|
||||
assign product_price = product.metafields.app--168074346497.min_auto_discounted_price.value | default: product.price
|
||||
|
||||
if product_price < product.price and product_compare_at_price == 0 or product_compare_at_price == blank
|
||||
assign product_compare_at_price = product.price
|
||||
endif
|
||||
|
||||
if product_price < product.price and product_compare_at_price_max == 0 or product_compare_at_price_max == blank
|
||||
assign product_compare_at_price_max = product.price_max
|
||||
endif
|
||||
# end - Yagi discounted price calculation
|
||||
|
||||
assign units = product.variants | map: 'unit_price' | compact
|
||||
if units[0]
|
||||
assign has_units = true
|
||||
else
|
||||
assign has_units = false
|
||||
endif
|
||||
-%}
|
||||
|
||||
<div
|
||||
class="product__block block-padding"
|
||||
{{ block_style }}
|
||||
{% if animation_name %}
|
||||
data-animation="{{ animation_name }}"
|
||||
data-animation-duration="{{ animation_duration }}"
|
||||
data-animation-delay="{{ animation_delay }}"
|
||||
{% endif %}
|
||||
>
|
||||
<div class="product__price__wrap">
|
||||
<div
|
||||
class="product__price{% if has_units %} product__price--has-units{% endif %}{% if price_font_size != blank %} {{ price_font_size }}{% endif %}"
|
||||
data-price-wrapper
|
||||
>
|
||||
<span
|
||||
data-product-price
|
||||
{% if current_variant_compare_at_price > current_variant_price %}
|
||||
class="product__price--sale"
|
||||
{% endif %}
|
||||
>
|
||||
{%- if current_variant_price == 0 -%}
|
||||
{{ 'general.money.free' | t }}
|
||||
{%- else -%}
|
||||
{{ current_variant_price | money }}
|
||||
{%- endif -%}
|
||||
</span>
|
||||
|
||||
{%- if product_compare_at_price_max > product_price -%}
|
||||
<span class="visually-hidden" data-compare-text>{{ 'products.product.regular_price' | t }}</span>
|
||||
<s class="product__price--strike" data-compare-price>
|
||||
{%- if current_variant_compare_at_price > current_variant_price -%}
|
||||
{{ current_variant_compare_at_price | money }}
|
||||
{%- endif -%}
|
||||
</s>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if has_units -%}
|
||||
{%- capture show_units -%}
|
||||
{%- unless current_variant.unit_price -%}style="display: none;"{%- endunless -%}
|
||||
{%- endcapture -%}
|
||||
|
||||
{%- capture unit_price_separator -%}
|
||||
<span aria-hidden="true">/</span><span class="visually-hidden">{{ 'general.accessibility.unit_price_separator' | t }} </span>
|
||||
{%- endcapture -%}
|
||||
|
||||
{%- capture unit_price_base_unit -%}
|
||||
<span>
|
||||
{% if current_variant.unit_price_measurement %}
|
||||
{% if current_variant.unit_price_measurement.reference_value != 1 %}
|
||||
{{ current_variant.unit_price_measurement.reference_value }}
|
||||
{%- endif -%}
|
||||
{{ current_variant.unit_price_measurement.reference_unit }}
|
||||
{% endif %}
|
||||
</span>
|
||||
{%- endcapture -%}
|
||||
|
||||
<div class="product__price__meta">
|
||||
<span data-product-unit {{ show_units }} class="product__price--unit">
|
||||
<span class="visually-hidden visually-hidden--inline">{{ 'products.product.unit_price_label' | t }}</span>
|
||||
<span data-product-unit-price id="unit-price-{{ unique }}">{{ current_variant.unit_price | money }}</span>
|
||||
{{ unit_price_separator }}
|
||||
<span data-product-base id="unit-price-base-{{ unique }}">{{ unit_price_base_unit }}</span>
|
||||
</span>
|
||||
<span data-price-each class="product__price--unit hidden">
|
||||
{{ 'products.product.each' | t }}
|
||||
<span data-price-each-amount></span>
|
||||
</span>
|
||||
</div>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
|
||||
{%- liquid
|
||||
assign sale_badge = settings.sale_badge
|
||||
assign final_sale = settings.final_sale | default: product.metafields.theme.final_sale.value
|
||||
assign final_sale_variant = false
|
||||
|
||||
for variant in product.variants
|
||||
if variant.metafields.theme.final_sale.value == true
|
||||
assign final_sale_variant = true
|
||||
endif
|
||||
endfor
|
||||
-%}
|
||||
|
||||
{%- if sale_badge or final_sale or final_sale_variant -%}
|
||||
<div
|
||||
class="product__sale"
|
||||
data-price-off
|
||||
{% if final_sale %}
|
||||
data-final-sale
|
||||
{% endif %}
|
||||
>
|
||||
{%- if sale_badge -%}
|
||||
<span class="product__price--off hidden" data-price-off-badge>
|
||||
<span data-price-off-amount></span>
|
||||
{{ 'products.product.off' | t }}
|
||||
</span>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if final_sale or final_sale_variant -%}
|
||||
<div class="product__final-sale-wrap hidden" data-final-sale-badge>
|
||||
<div class="product__final-sale">{{ 'products.product.final_sale' | t }}</div>
|
||||
<tooltip-component
|
||||
class="product__final-sale-question"
|
||||
data-tooltip="<div style='--text: var(--COLOR-SALE);'>{{ settings.final_sale_tooltip | replace: '"', "'" }}</div>"
|
||||
>
|
||||
{%- render 'icon-question' -%}
|
||||
</tooltip-component>
|
||||
</div>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
|
||||
{% comment %} Shop pay split payment terms {% endcomment %}
|
||||
<div class="shop-pay-terms">
|
||||
{%- assign product_form_installment_id = 'product-form-installment-'
|
||||
| append: unique
|
||||
| append: '-'
|
||||
| append: product.id
|
||||
-%}
|
||||
{%- form 'product',
|
||||
product,
|
||||
id: product_form_installment_id,
|
||||
class: 'installment',
|
||||
data-product-form-installment: ''
|
||||
-%}
|
||||
<input type="hidden" name="id" value="{{ current_variant.id }}">
|
||||
{{ form | payment_terms }}
|
||||
{%- endform -%}
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user