initial commit
This commit is contained in:
commit
2a67aae9ae
2 files changed
+1037
No files matched your search
@@ -0,0 +1,685 @@
|
|||||||
|
{%- unless template.suffix contains 'quick-buy' -%}
|
||||||
|
<style>
|
||||||
|
#shopify-section-{{ section.id }} {
|
||||||
|
{%- assign buy_buttons_block = section.blocks | where: 'type', 'buy_buttons' | first -%}
|
||||||
|
|
||||||
|
{%- if buy_buttons_block.settings.show_payment_button -%}
|
||||||
|
{%- if buy_buttons_block.settings.atc_button_background == 'rgba(0,0,0,0)' -%}
|
||||||
|
{%- assign secondary_button_background = settings.secondary_button_background -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- assign secondary_button_background = buy_buttons_block.settings.atc_button_background -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- if buy_buttons_block.settings.atc_button_text_color == 'rgba(0,0,0,0)' -%}
|
||||||
|
{%- assign secondary_button_text_color = settings.secondary_button_text_color -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- assign secondary_button_text_color = buy_buttons_block.settings.atc_button_text_color -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- if buy_buttons_block.settings.buy_now_button_background == 'rgba(0,0,0,0)' -%}
|
||||||
|
{%- assign primary_button_background = settings.primary_button_background -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- assign primary_button_background = buy_buttons_block.settings.buy_now_button_background -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- if buy_buttons_block.settings.buy_now_button_text_color == 'rgba(0,0,0,0)' -%}
|
||||||
|
{%- assign primary_button_text_color = settings.primary_button_text_color -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- assign primary_button_text_color = buy_buttons_block.settings.buy_now_button_text_color -%}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- if buy_buttons_block.settings.atc_button_background == 'rgba(0,0,0,0)' -%}
|
||||||
|
{%- assign primary_button_background = settings.primary_button_background -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- assign primary_button_background = buy_buttons_block.settings.atc_button_background -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- if buy_buttons_block.settings.atc_button_text_color == 'rgba(0,0,0,0)' -%}
|
||||||
|
{%- assign primary_button_text_color = settings.primary_button_text_color -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- assign primary_button_text_color = buy_buttons_block.settings.atc_button_text_color -%}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
--primary-button-background: {{ primary_button_background.red }}, {{ primary_button_background.green }}, {{ primary_button_background.blue }};
|
||||||
|
--primary-button-text-color: {{ primary_button_text_color.red }}, {{ primary_button_text_color.green }}, {{ primary_button_text_color.blue }};
|
||||||
|
--secondary-button-background: {{ secondary_button_background.red }}, {{ secondary_button_background.green }}, {{ secondary_button_background.blue }};
|
||||||
|
--secondary-button-text-color: {{ secondary_button_text_color.red }}, {{ secondary_button_text_color.green }}, {{ secondary_button_text_color.blue }};
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
{%- if section.settings.show_sticky_add_to_cart and product.available -%}
|
||||||
|
{%- render 'product-sticky-form', product: product -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<nav aria-label="{{ 'general.breadcrumb.title' | t }}" class="breadcrumb text--xsmall hidden-phone">
|
||||||
|
<ol class="breadcrumb__list" role="list">
|
||||||
|
<li class="breadcrumb__item">
|
||||||
|
<a class="breadcrumb__link" href="{{ routes.root_url }}">{{ 'general.breadcrumb.home' | t }}</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{%- if collection -%}
|
||||||
|
<li class="breadcrumb__item">
|
||||||
|
<a class="breadcrumb__link" href="{{ collection.url }}">{{- collection.title -}}</a>
|
||||||
|
</li>
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
<li class="breadcrumb__item">
|
||||||
|
<span class="breadcrumb__link" aria-current="page">{{ product.title }}</span>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<!-- PRODUCT TOP PART -->
|
||||||
|
<div class="product product--thumbnails-{{ section.settings.desktop_thumbnails_position }}">
|
||||||
|
{%- render 'product-media', product: product -%}
|
||||||
|
{%- render 'product-info', product: product, update_url: true -%}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{%- else -%}
|
||||||
|
{%- comment -%}
|
||||||
|
The quick shop HTML being very different, we render it here. On mobile and tablet/desktop, the product renders also
|
||||||
|
quite differently, as it is in a drawer on tablet/desktop, and a popover on mobile.
|
||||||
|
{%- endcomment -%}
|
||||||
|
|
||||||
|
{%- capture quick_buy_product_info -%}
|
||||||
|
<div class="quick-buy-product">
|
||||||
|
{%- assign featured_media = product.selected_or_first_available_variant.featured_media | default: product.featured_media -%}
|
||||||
|
|
||||||
|
{%- if template.suffix == 'quick-buy-drawer' -%}
|
||||||
|
{{- featured_media | image_url: width: featured_media.width | image_tag: loading: 'lazy', sizes: '114px', widths: '114,228,342', class: 'quick-buy-product__image' -}}
|
||||||
|
{%- else -%}
|
||||||
|
{{- featured_media | image_url: width: featured_media.width | image_tag: loading: 'lazy', sizes: '65px', widths: '65,130,195', class: 'quick-buy-product__image' -}}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
<div class="quick-buy-product__info {% if template.suffix == 'quick-buy-popover' %}text--small{% endif %}">
|
||||||
|
<product-meta form-id="product-form-{{ section.id }}-{{ product.id }}" unit-price-class="text--xsmall" class="product-item-meta">
|
||||||
|
{%- if section.settings.show_vendor -%}
|
||||||
|
{%- assign vendor_handle = product.vendor | handle -%}
|
||||||
|
{%- assign collection_for_vendor = collections[vendor_handle] -%}
|
||||||
|
|
||||||
|
{%- unless collection_for_vendor.empty? -%}
|
||||||
|
<a href="{{ collection_for_vendor.url }}" class="product-item-meta__vendor heading {% if template.suffix == 'quick-buy-drawer' %}heading--small{% else %}heading--xsmall{% endif %}">{{ product.vendor }}</a>
|
||||||
|
{%- else -%}
|
||||||
|
<a href="{{ product.vendor | url_for_vendor }}" class="product-item-meta__vendor heading {% if template.suffix == 'quick-buy-drawer' %}heading--small{% else %}heading--xsmall{% endif %}">{{ product.vendor }}</a>
|
||||||
|
{%- endunless -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
<a href="{{ product.url }}" class="product-item-meta__title">{{ product.title }}</a>
|
||||||
|
|
||||||
|
{% liquid
|
||||||
|
# start Yagi app code
|
||||||
|
assign target = product.selected_or_first_available_variant
|
||||||
|
assign variant_price = product.selected_or_first_available_variant.price
|
||||||
|
assign variant_compare_at_price = product.selected_or_first_available_variant.compare_at_price
|
||||||
|
|
||||||
|
assign active_discount = true
|
||||||
|
|
||||||
|
assign empty_array = "" | split: ""
|
||||||
|
assign dormant_discounts = shop.metafields.app--168074346497.dormant_discounts.value | default: empty_array
|
||||||
|
assign target_discount_id = product.metafields.app--168074346497.applied_discount_id.value
|
||||||
|
for dormant_discount in dormant_discounts
|
||||||
|
if dormant_discount == target_discount_id
|
||||||
|
assign active_discount = false
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
if active_discount
|
||||||
|
assign variant_price = target.metafields.app--168074346497.auto_discounted_price.value | default: target.price
|
||||||
|
|
||||||
|
if target.metafields.app--168074346497.discount_type.value != nil and target.metafields.app--168074346497.discount_type.value != "fixed" and product.metafields.app--168074346497.discount_percentage.value > 0.01
|
||||||
|
assign deducted_percentage = 1.0 | minus: product.metafields.app--168074346497.discount_percentage.value
|
||||||
|
|
||||||
|
if target.metafields.app--168074346497.discount_percentage.value > 0.01
|
||||||
|
assign deducted_percentage = 1.0 | minus: target.metafields.app--168074346497.discount_percentage.value
|
||||||
|
endif
|
||||||
|
|
||||||
|
assign variant_price = target.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil
|
||||||
|
|
||||||
|
assign variant_compare_at_price = target.price
|
||||||
|
|
||||||
|
if target.compare_at_price > variant_compare_at_price
|
||||||
|
assign variant_compare_at_price = target.compare_at_price
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if variant_price < target.price and variant_compare_at_price == blank
|
||||||
|
assign variant_compare_at_price = target.price
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
# end Yagi app code
|
||||||
|
%}
|
||||||
|
<div class="product-item-meta__price-list-container" role="region" aria-live="polite">
|
||||||
|
<div class="price-list" data-product-price-list data-yagi-product="{{ product.selected_or_first_available_variant.metafields.app--168074346497.auto_discounted_price.value }}">
|
||||||
|
{%- if variant_compare_at_price > variant_price -%}
|
||||||
|
<span class="price price--highlight">
|
||||||
|
<span class="visually-hidden">{{ 'product.general.sale_price' | t }}</span>
|
||||||
|
|
||||||
|
{%- if settings.currency_code_enabled -%}
|
||||||
|
{{- variant_price | money_with_currency -}}
|
||||||
|
{%- else -%}
|
||||||
|
{{- variant_price | money -}}
|
||||||
|
{%- endif -%}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span class="price price--compare">
|
||||||
|
<span class="visually-hidden">{{ 'product.general.regular_price' | t }}</span>
|
||||||
|
|
||||||
|
{%- if settings.currency_code_enabled -%}
|
||||||
|
{{- variant_compare_at_price | money_with_currency -}}
|
||||||
|
{%- else -%}
|
||||||
|
{{- variant_compare_at_price | money -}}
|
||||||
|
{%- endif -%}
|
||||||
|
</span>
|
||||||
|
{%- else -%}
|
||||||
|
<span class="price">
|
||||||
|
<span class="visually-hidden">{{ 'product.general.sale_price' | t }}</span>
|
||||||
|
|
||||||
|
{%- if settings.currency_code_enabled -%}
|
||||||
|
{{- variant_price | money_with_currency -}}
|
||||||
|
{%- else -%}
|
||||||
|
{{- variant_price | money -}}
|
||||||
|
{%- endif -%}
|
||||||
|
</span>
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- if product.selected_or_first_available_variant.unit_price_measurement -%}
|
||||||
|
<div class="price text--subdued text--xsmall">
|
||||||
|
<div class="unit-price-measurement">
|
||||||
|
<span class="unit-price-measurement__price">{{ product.selected_or_first_available_variant.unit_price | money }}</span>
|
||||||
|
<span class="unit-price-measurement__separator">/</span>
|
||||||
|
|
||||||
|
{%- if product.selected_or_first_available_variant.unit_price_measurement.reference_value != 1 -%}
|
||||||
|
<span class="unit-price-measurement__reference-value">{{ product.selected_or_first_available_variant.unit_price_measurement.reference_value }}</span>
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
<span class="unit-price-measurement__reference-unit">{{ product.selected_or_first_available_variant.unit_price_measurement.reference_unit }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{%- endif -%}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{%- if template.suffix == 'quick-buy-popover' -%}
|
||||||
|
<a href="{{ product.url }}" class="link text--subdued">{{ 'product.general.view_details' | t }}</a>
|
||||||
|
{%- endif -%}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{%- if section.settings.show_taxes_included -%}
|
||||||
|
{%- if cart.taxes_included or shop.shipping_policy.body != blank -%}
|
||||||
|
<p class="product-meta__taxes-included text--small">
|
||||||
|
{%- if cart.taxes_included -%}
|
||||||
|
{{ 'product.general.include_taxes' | t }}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- if shop.shipping_policy.body != blank -%}
|
||||||
|
{{ 'product.general.shipping_policy_html' | t: link: shop.shipping_policy.url }}
|
||||||
|
{%- endif -%}
|
||||||
|
</p>
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endif -%}
|
||||||
|
</product-meta>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{%- endcapture -%}
|
||||||
|
|
||||||
|
{%- if template.suffix == 'quick-buy-drawer' -%}
|
||||||
|
<quick-buy-drawer class="drawer drawer--large drawer--quick-buy">
|
||||||
|
<cart-notification hidden class="cart-notification cart-notification--drawer"></cart-notification>
|
||||||
|
|
||||||
|
<span class="drawer__overlay"></span>
|
||||||
|
|
||||||
|
<header class="drawer__header">
|
||||||
|
<p class="drawer__title heading h6">{{ 'product.form.choose_options' | t }}</p>
|
||||||
|
|
||||||
|
<button type="button" class="drawer__close-button tap-area" data-action="close" title="{{ 'general.accessibility.close' | t | escape }}">
|
||||||
|
{%- render 'icon' with 'close' -%}
|
||||||
|
</button>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="drawer__content">
|
||||||
|
{{- quick_buy_product_info -}}
|
||||||
|
{%- render 'product-form', product: product -%}
|
||||||
|
</div>
|
||||||
|
</quick-buy-drawer>
|
||||||
|
{%- elsif template.suffix == 'quick-buy-popover' -%}
|
||||||
|
<quick-buy-popover class="popover popover--quick-buy">
|
||||||
|
<span class="popover__overlay"></span>
|
||||||
|
|
||||||
|
<header class="popover__header">
|
||||||
|
{{- quick_buy_product_info -}}
|
||||||
|
|
||||||
|
<button type="button" class="popover__close-button tap-area tap-area--large" data-action="close" title="{{ 'general.accessibility.close' | t | escape }}">
|
||||||
|
{%- render 'icon' with 'close' -%}
|
||||||
|
</button>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="popover__content popover__content--no-padding">
|
||||||
|
{%- render 'product-form', product: product -%}
|
||||||
|
</div>
|
||||||
|
</quick-buy-popover>
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endunless -%}
|
||||||
|
|
||||||
|
{% schema %}
|
||||||
|
{
|
||||||
|
"name": "Product page",
|
||||||
|
"class": "shopify-section--main-product",
|
||||||
|
"blocks": [
|
||||||
|
{
|
||||||
|
"type": "@app"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "variant_picker",
|
||||||
|
"name": "Variant picker",
|
||||||
|
"limit": 1,
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"type": "checkbox",
|
||||||
|
"id": "hide_sold_out_variants",
|
||||||
|
"label": "Hide sold out variants",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "select",
|
||||||
|
"id": "selector_mode",
|
||||||
|
"label": "Selector type",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"value": "block",
|
||||||
|
"label": "Block"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "dropdown",
|
||||||
|
"label": "Dropdown"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default": "block"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "select",
|
||||||
|
"id": "color_mode",
|
||||||
|
"label": "Color selector type",
|
||||||
|
"info": "Enable [swatches](https://help.shopify.com/en/manual/online-store/themes/theme-structure/theme-settings#options-with-swatches) on product options.",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"value": "swatch",
|
||||||
|
"label": "Swatch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "none",
|
||||||
|
"label": "None"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default": "swatch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"id": "variant_image_options",
|
||||||
|
"label": "Show variant image for options"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "page",
|
||||||
|
"id": "size_chart_page",
|
||||||
|
"label": "Size chart page",
|
||||||
|
"info": "Feature a page for size option"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "quantity_selector",
|
||||||
|
"name": "Quantity selector",
|
||||||
|
"limit": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "buy_buttons",
|
||||||
|
"name": "Buy buttons",
|
||||||
|
"limit": 1,
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"type": "checkbox",
|
||||||
|
"id": "show_payment_button",
|
||||||
|
"label": "Show dynamic checkout button",
|
||||||
|
"info": "Each customer will see their preferred payment method from those available on your store, such as PayPal or Apple Pay. [Learn more](https://help.shopify.com/manual/using-themes/change-the-layout/dynamic-checkout)",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "checkbox",
|
||||||
|
"id": "show_gift_card_recipient",
|
||||||
|
"label": "Show recipient information form for gift card products",
|
||||||
|
"info": "Gift card products can optionally be sent directly to a recipient along with a personal message. [Learn more](https://help.shopify.com/manual/online-store/themes/customizing-themes/add-gift-card-recipient-fields)",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "color",
|
||||||
|
"id": "atc_button_background",
|
||||||
|
"label": "Add to cart background",
|
||||||
|
"default": "rgba(0,0,0,0)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "color",
|
||||||
|
"id": "atc_button_text_color",
|
||||||
|
"label": "Add to cart color",
|
||||||
|
"default": "rgba(0,0,0,0)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "color",
|
||||||
|
"id": "buy_now_button_background",
|
||||||
|
"label": "Buy now background",
|
||||||
|
"default": "rgba(0,0,0,0)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "color",
|
||||||
|
"id": "buy_now_button_text_color",
|
||||||
|
"label": "Buy now color",
|
||||||
|
"default": "rgba(0,0,0,0)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "description",
|
||||||
|
"name": "Description",
|
||||||
|
"limit": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "inventory",
|
||||||
|
"name": "Inventory",
|
||||||
|
"limit": 1,
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"type": "range",
|
||||||
|
"id": "low_inventory_threshold",
|
||||||
|
"label": "Low inventory threshold",
|
||||||
|
"info": "Use low stock color when quantity is below the threshold. Choose 0 to always show in stock.",
|
||||||
|
"min": 0,
|
||||||
|
"max": 100,
|
||||||
|
"step": 1,
|
||||||
|
"default": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "Text",
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"type": "richtext",
|
||||||
|
"id": "text",
|
||||||
|
"label": "Text"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "image",
|
||||||
|
"name": "Image",
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"type": "image_picker",
|
||||||
|
"id": "image",
|
||||||
|
"label": "Image"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "select",
|
||||||
|
"id": "image_alignment",
|
||||||
|
"label": "Alignment",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"value": "left",
|
||||||
|
"label": "Left"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "center",
|
||||||
|
"label": "Center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "right",
|
||||||
|
"label": "Right"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default": "left"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "range",
|
||||||
|
"id": "image_width",
|
||||||
|
"min": 50,
|
||||||
|
"max": 500,
|
||||||
|
"step": 10,
|
||||||
|
"unit": "px",
|
||||||
|
"label": "Width",
|
||||||
|
"default": 150
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "button",
|
||||||
|
"name": "Button",
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"type": "paragraph",
|
||||||
|
"content": "Create link to your contact page, external marketplace..."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "url",
|
||||||
|
"id": "link",
|
||||||
|
"label": "Link"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"id": "text",
|
||||||
|
"label": "Text"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "checkbox",
|
||||||
|
"id": "stretch",
|
||||||
|
"label": "Stretch button",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "color",
|
||||||
|
"id": "background",
|
||||||
|
"label": "Background",
|
||||||
|
"default": "rgba(0,0,0,0)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "color",
|
||||||
|
"id": "text_color",
|
||||||
|
"label": "Text color",
|
||||||
|
"default": "rgba(0,0,0,0)"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "liquid",
|
||||||
|
"name": "Custom Liquid",
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"type": "liquid",
|
||||||
|
"id": "liquid",
|
||||||
|
"label": "Liquid",
|
||||||
|
"info": "Add app snippets or other Liquid code to create advanced customizations."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "line_item_property",
|
||||||
|
"name": "Line item property",
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"type": "paragraph",
|
||||||
|
"content": "Line item properties are used to collect customization information for an item added to the cart."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"id": "label",
|
||||||
|
"label": "Label",
|
||||||
|
"default": "Your label"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "select",
|
||||||
|
"id": "type",
|
||||||
|
"label": "Type",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"value": "text",
|
||||||
|
"label": "Text"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "checkbox",
|
||||||
|
"label": "Checkbox"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default": "text"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "header",
|
||||||
|
"content": "Text",
|
||||||
|
"info": "Only applicable for line item property of type Text."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "checkbox",
|
||||||
|
"id": "required",
|
||||||
|
"label": "Required",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "checkbox",
|
||||||
|
"id": "allow_long_text",
|
||||||
|
"label": "Allow long text",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "header",
|
||||||
|
"content": "Checkbox",
|
||||||
|
"info": "Only applicable for line item property of type Checkbox."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"id": "checked_value",
|
||||||
|
"label": "Checked value",
|
||||||
|
"default": "Yes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"id": "unchecked_value",
|
||||||
|
"label": "Unchecked value",
|
||||||
|
"default": "No"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"type": "checkbox",
|
||||||
|
"id": "show_vendor",
|
||||||
|
"label": "Show vendor",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "checkbox",
|
||||||
|
"id": "show_sku",
|
||||||
|
"label": "Show SKU",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "checkbox",
|
||||||
|
"id": "show_taxes_included",
|
||||||
|
"label": "Show taxes included",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "checkbox",
|
||||||
|
"id": "show_product_rating",
|
||||||
|
"label": "Show product rating",
|
||||||
|
"info": "To display a rating, add a product rating app. [Learn more](https://help.shopify.com/en/manual/products/product-reviews/installation)",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "checkbox",
|
||||||
|
"id": "show_sticky_add_to_cart",
|
||||||
|
"label": "Show sticky add to cart",
|
||||||
|
"info": "Will be hidden if no Buy buttons block is added onto the page.",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "checkbox",
|
||||||
|
"id": "show_share_buttons",
|
||||||
|
"label": "Show share buttons",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "page",
|
||||||
|
"id": "help_page",
|
||||||
|
"label": "Help page",
|
||||||
|
"info": "Feature a page to help your customers"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "header",
|
||||||
|
"content": "Media"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "paragraph",
|
||||||
|
"content": "Learn more about [media types](https://help.shopify.com/en/manual/products/product-media)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "checkbox",
|
||||||
|
"id": "enable_video_autoplay",
|
||||||
|
"label": "Enable video autoplay",
|
||||||
|
"info": "Video are muted automatically to allow autoplay",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "checkbox",
|
||||||
|
"id": "enable_video_looping",
|
||||||
|
"label": "Enable video looping",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "checkbox",
|
||||||
|
"id": "enable_image_zoom",
|
||||||
|
"label": "Enable image zoom",
|
||||||
|
"info": "Zoom does not show video nor 3D models.",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "checkbox",
|
||||||
|
"id": "show_thumbnails_on_mobile",
|
||||||
|
"label": "Show thumbnails on mobile",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "select",
|
||||||
|
"id": "desktop_thumbnails_position",
|
||||||
|
"label": "Desktop thumbnails position",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"value": "left",
|
||||||
|
"label": "Left"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "bottom",
|
||||||
|
"label": "Bottom"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default": "bottom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "select",
|
||||||
|
"id": "transition_effect",
|
||||||
|
"label": "Transition effect",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"value": "slide",
|
||||||
|
"label": "Slide"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "fade",
|
||||||
|
"label": "Fade"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default": "slide"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
{% endschema %}
|
||||||
@@ -0,0 +1,352 @@
|
|||||||
|
{%- capture product_form_id -%}product-form-{{ section.id }}-{{ product.id }}{%- endcapture -%}
|
||||||
|
|
||||||
|
<div class="product__info">
|
||||||
|
<!-- PRODUCT META -->
|
||||||
|
<product-meta form-id="{{ product_form_id }}" price-class="price--large" class="product-meta">
|
||||||
|
{%- if section.settings.show_vendor -%}
|
||||||
|
<h2 class="product-meta__vendor heading heading--small">
|
||||||
|
{%- assign vendor_handle = product.vendor | handle -%}
|
||||||
|
{%- assign vendor_collection = collections[vendor_handle] -%}
|
||||||
|
|
||||||
|
{%- if vendor_collection != blank -%}
|
||||||
|
<a href="{{ vendor_collection.url }}">{{ product.vendor }}</a>
|
||||||
|
{%- else -%}
|
||||||
|
<a href="{{ product.vendor | url_for_vendor }}">{{ product.vendor }}</a>
|
||||||
|
{%- endif -%}
|
||||||
|
</h2>
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{% unless featured %}
|
||||||
|
<h1 class="product-meta__title heading h3">{{ product.title }}</h1>
|
||||||
|
{% else %}
|
||||||
|
<h2 class="product-meta__title heading h3">
|
||||||
|
<a href="{{ product.url }}">{{ product.title }}</a>
|
||||||
|
</h2>
|
||||||
|
{% endunless %}
|
||||||
|
|
||||||
|
{% liquid
|
||||||
|
# start Yagi app code
|
||||||
|
assign target = product.selected_or_first_available_variant
|
||||||
|
assign variant_price = product.selected_or_first_available_variant.price
|
||||||
|
assign variant_compare_at_price = product.selected_or_first_available_variant.compare_at_price
|
||||||
|
|
||||||
|
assign active_discount = true
|
||||||
|
|
||||||
|
assign empty_array = "" | split: ""
|
||||||
|
assign dormant_discounts = shop.metafields.app--168074346497.dormant_discounts.value | default: empty_array
|
||||||
|
assign target_discount_id = product.metafields.app--168074346497.applied_discount_id.value
|
||||||
|
for dormant_discount in dormant_discounts
|
||||||
|
if dormant_discount == target_discount_id
|
||||||
|
assign active_discount = false
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
if active_discount
|
||||||
|
assign variant_price = target.metafields.app--168074346497.auto_discounted_price.value | default: target.price
|
||||||
|
|
||||||
|
if target.metafields.app--168074346497.discount_type.value != nil and target.metafields.app--168074346497.discount_type.value != "fixed" and product.metafields.app--168074346497.discount_percentage.value > 0.01
|
||||||
|
assign deducted_percentage = 1.0 | minus: product.metafields.app--168074346497.discount_percentage.value
|
||||||
|
|
||||||
|
if target.metafields.app--168074346497.discount_percentage.value > 0.01
|
||||||
|
assign deducted_percentage = 1.0 | minus: target.metafields.app--168074346497.discount_percentage.value
|
||||||
|
endif
|
||||||
|
|
||||||
|
assign variant_price = target.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil
|
||||||
|
|
||||||
|
assign variant_compare_at_price = target.price
|
||||||
|
|
||||||
|
if target.compare_at_price > variant_compare_at_price
|
||||||
|
assign variant_compare_at_price = target.compare_at_price
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if variant_price < target.price and variant_compare_at_price == blank
|
||||||
|
assign variant_compare_at_price = target.price
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
# end Yagi app code
|
||||||
|
%}
|
||||||
|
<div class="product-meta__price-list-container" role="region" aria-live="polite">
|
||||||
|
<div class="price-list" data-product-price-list data-yagi-product-info="{{ product.selected_or_first_available_variant.metafields.app--168074346497.auto_discounted_price.value }}">
|
||||||
|
{%- if variant_compare_at_price > variant_price -%}
|
||||||
|
<span class="price price--highlight price--large yagi-large">
|
||||||
|
<span class="visually-hidden">{{ 'product.general.sale_price' | t }}</span>
|
||||||
|
|
||||||
|
<span class="yagi-discounted-price" data-price-yagi>
|
||||||
|
{%- if settings.currency_code_enabled -%}
|
||||||
|
{{- variant_price | money_with_currency -}}
|
||||||
|
{%- else -%}
|
||||||
|
{{- variant_price | money -}}
|
||||||
|
{%- endif -%}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span class="price price--compare">
|
||||||
|
<span class="visually-hidden">{{ 'product.general.regular_price' | t }}</span>
|
||||||
|
|
||||||
|
<span class="yagi-original-price" data-compare-at-price-yagi>
|
||||||
|
{%- if settings.currency_code_enabled -%}
|
||||||
|
{{- variant_compare_at_price | money_with_currency -}}
|
||||||
|
{%- else -%}
|
||||||
|
{{- variant_compare_at_price | money -}}
|
||||||
|
{%- endif -%}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
{%- else -%}
|
||||||
|
<span class="price price--large">
|
||||||
|
<span class="visually-hidden">{{ 'product.general.sale_price' | t }}</span>
|
||||||
|
<span class="yagi-discounted-price" data-price-yagi>
|
||||||
|
{%- if settings.currency_code_enabled -%}
|
||||||
|
{{- variant_price | money_with_currency -}}
|
||||||
|
{%- else -%}
|
||||||
|
{{- variant_price | money -}}
|
||||||
|
{%- endif -%}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- if product.selected_or_first_available_variant.unit_price_measurement -%}
|
||||||
|
<div class="price text--subdued">
|
||||||
|
<div class="unit-price-measurement">
|
||||||
|
<span class="unit-price-measurement__price">{{ product.selected_or_first_available_variant.unit_price | money }}</span>
|
||||||
|
<span class="unit-price-measurement__separator">/</span>
|
||||||
|
|
||||||
|
{%- if product.selected_or_first_available_variant.unit_price_measurement.reference_value != 1 -%}
|
||||||
|
<span class="unit-price-measurement__reference-value">{{ product.selected_or_first_available_variant.unit_price_measurement.reference_value }}</span>
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
<span class="unit-price-measurement__reference-unit">{{ product.selected_or_first_available_variant.unit_price_measurement.reference_unit }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{%- endif -%}
|
||||||
|
<!-- Start of Judge.me code -->
|
||||||
|
<div class='jdgm-widget jdgm-preview-badge' data-id='{{ product.id }}'>
|
||||||
|
{{ product.metafields.judgeme.badge }}
|
||||||
|
</div>
|
||||||
|
<!-- End of Judge.me code -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span class="pro_save">
|
||||||
|
<div class="product-meta__label-list label-list" data-product-label-list>
|
||||||
|
{%- unless product.selected_or_first_available_variant.available -%}
|
||||||
|
<span class="label label--subdued">{{ 'collection.product.sold_out' | t }}</span>
|
||||||
|
{%- elsif product.selected_or_first_available_variant.compare_at_price > product.selected_or_first_available_variant.price -%}
|
||||||
|
{%- if settings.discount_mode == 'percentage' -%}
|
||||||
|
{%- assign savings = product.selected_or_first_available_variant.compare_at_price | minus: product.selected_or_first_available_variant.price | times: 100.0 | divided_by: product.selected_or_first_available_variant.compare_at_price | round | append: '%' -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- capture savings -%}{{ product.selected_or_first_available_variant.compare_at_price | minus: product.selected_or_first_available_variant.price | money }}{%- endcapture -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
<span class="label label--highlight">{{ 'collection.product.discount_html' | t: savings: savings }}</span>
|
||||||
|
{%- endunless -%}
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{%- if section.settings.show_taxes_included -%}
|
||||||
|
{%- if cart.taxes_included or shop.shipping_policy.body != blank -%}
|
||||||
|
<p class="product-meta__taxes-included text--small">
|
||||||
|
{%- if cart.taxes_included -%}
|
||||||
|
{{ 'product.general.include_taxes' | t }}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- if shop.shipping_policy.body != blank -%}
|
||||||
|
{{ 'product.general.shipping_policy_html' | t: link: shop.shipping_policy.url }}
|
||||||
|
{%- endif -%}
|
||||||
|
</p>
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
<product-payment-terms form-id="{{ product_form_id }}">
|
||||||
|
{%- assign product_installment_form_id = 'product-installment-form-' | append: section.id | append: '-' | append: product.id -%}
|
||||||
|
|
||||||
|
{%- form 'product', product, id: product_installment_form_id -%}
|
||||||
|
<input type="hidden" name="id" value="{{ product.selected_or_first_available_variant.id }}">
|
||||||
|
{{- form | payment_terms -}}
|
||||||
|
{%- endform -%}
|
||||||
|
</product-payment-terms>
|
||||||
|
|
||||||
|
{%- if section.settings.show_product_rating or section.settings.show_sku -%}
|
||||||
|
<div class="product-meta__reference">
|
||||||
|
{%- if section.settings.show_product_rating -%}
|
||||||
|
<a href="{% if featured %}{{ product.url }}{% endif %}#product-{{ product.id }}-reviews-pocket" is="review-link" data-smooth-scroll class="product-meta__reviews-badge hidden-lap-and-up">{%- render 'product-rating', product: product -%}</a>
|
||||||
|
<a href="{% if featured %}{{ product.url }}{% endif %}#product-{{ product.id }}-tabs" is="review-link" data-smooth-scroll class="product-meta__reviews-badge hidden-pocket">{%- render 'product-rating', product: product -%}</a>
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- if section.settings.show_sku -%}
|
||||||
|
<span class="product-meta__sku text--subdued text--xxsmall" {% if product.selected_or_first_available_variant.sku == blank %}style="display: none"{% endif %} data-product-sku-container>
|
||||||
|
{{- 'product.general.sku' | t }}
|
||||||
|
<span class="product-meta__sku-number" data-product-sku-number>{{ product.selected_or_first_available_variant.sku }}</span>
|
||||||
|
</span>
|
||||||
|
{%- endif -%}
|
||||||
|
</div>
|
||||||
|
{%- endif -%}
|
||||||
|
</product-meta>
|
||||||
|
|
||||||
|
{%- render 'product-form', product: product, update_url: update_url -%}
|
||||||
|
|
||||||
|
{%- assign help_page = section.settings.help_page -%}
|
||||||
|
|
||||||
|
{%- if section.settings.show_share_buttons or help_page != blank -%}
|
||||||
|
<div class="product-meta__aside">
|
||||||
|
{%- if section.settings.show_share_buttons -%}
|
||||||
|
<div class="product-meta__share text--subdued">
|
||||||
|
{%- assign share_url = shop.url | append: product.url -%}
|
||||||
|
{%- assign twitter_text = product.title | url_param_escape -%}
|
||||||
|
{%- assign pinterest_description = product.description | strip_html | truncatewords: 15 | url_param_escape -%}
|
||||||
|
{%- assign pinterest_image = product.featured_image | image_url: width: 800 | prepend: 'https:' -%}
|
||||||
|
|
||||||
|
<button is="share-toggle-button" share-url="{{ share_url | escape }}" share-title="{{ product.title | escape }}" class="product-meta__share-label link hidden-tablet-and-up" aria-controls="mobile-share-buttons-{{ section.id }}" aria-expanded="false">{{ 'product.general.share' | t }}</button>
|
||||||
|
<div class="product-meta__share-label hidden-phone">{{ 'product.general.share' | t }}</div>
|
||||||
|
|
||||||
|
<popover-content id="mobile-share-buttons-{{ section.id }}" class="popover hidden-tablet-and-up">
|
||||||
|
<span class="popover__overlay"></span>
|
||||||
|
|
||||||
|
<header class="popover__header">
|
||||||
|
<span class="popover__title heading h6">{{- 'article.general.share' | t -}}</span>
|
||||||
|
|
||||||
|
<button type="button" class="popover__close-button tap-area tap-area--large" data-action="close" title="{{ 'general.accessibility.close' | t | escape }}">
|
||||||
|
{%- render 'icon' with 'close' -%}
|
||||||
|
</button>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="mobile-share-buttons">
|
||||||
|
<a class="mobile-share-buttons__item mobile-share-buttons__item--facebook" href="https://www.facebook.com/sharer.php?u={{ share_url }}" target="_blank" rel="noopener" aria-label="{{ 'general.social.facebook_share' | t }}">
|
||||||
|
{%- render 'icon' with 'facebook-share-mobile' -%} Facebook
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class="mobile-share-buttons__item mobile-share-buttons__item--pinterest" href="https://pinterest.com/pin/create/button/?url={{ share_url }}{% if pinterest_image != blank %}&media={{ pinterest_image }}{% endif %}&description={{ pinterest_description }}" target="_blank" rel="noopener" aria-label="{{ 'general.social.pinterest_pin' | t }}">
|
||||||
|
{%- render 'icon' with 'pinterest-share-mobile' -%} Pinterest
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class="mobile-share-buttons__item mobile-share-buttons__item--twitter" href="https://twitter.com/intent/tweet?{% if twitter_text != blank %}text={{twitter_text}}&{% endif %}url={{ share_url }}" target="_blank" rel="noopener" aria-label="{{ 'general.social.twitter_tweet' | t }}">
|
||||||
|
{%- render 'icon' with 'twitter-share-mobile' -%} Twitter
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class="mobile-share-buttons__item mobile-share-buttons__item--mail" href="mailto:?&subject={{ article.title | escape }}&body={{ share_url }}" aria-label="{{ 'general.social.email_share' | t }}">
|
||||||
|
{%- render 'icon' with 'email-share-mobile' -%} {{ 'general.social.email_label' | t }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</popover-content>
|
||||||
|
|
||||||
|
<div class="product-meta__share-button-list hidden-phone">
|
||||||
|
<a class="product-meta__share-button-item product-meta__share-button-item--facebook link tap-area" href="https://www.facebook.com/sharer.php?u={{ share_url }}" target="_blank" rel="noopener" aria-label="{{ 'general.social.facebook_share' | t }}">
|
||||||
|
{%- render 'icon' with 'facebook', width: 8, height: 14 -%}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class="product-meta__share-button-item product-meta__share-button-item--pinterest link tap-area" href="https://pinterest.com/pin/create/button/?url={{ share_url }}{% if pinterest_image != blank %}&media={{ pinterest_image }}{% endif %}&description={{ pinterest_description }}" target="_blank" rel="noopener" aria-label="{{ 'general.social.pinterest_pin' | t }}">
|
||||||
|
{%- render 'icon' with 'pinterest', width: 10, height: 14 -%}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class="product-meta__share-button-item product-meta__share-button-item--twitter link tap-area" href="https://twitter.com/intent/tweet?{% if twitter_text != blank %}text={{ twitter_text }}&{% endif %}url={{ share_url }}" target="_blank" rel="noopener" aria-label="{{ 'general.social.twitter_tweet' | t }}">
|
||||||
|
{%- render 'icon' with 'twitter', width: 17, height: 14 -%}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class="product-meta__share-button-item product-meta__share-button-item--mail link tap-area" href="mailto:?&subject={{ product.title | escape }}&body={{ share_url }}" aria-label="{{ 'general.social.email_share' | t }}">
|
||||||
|
{%- render 'icon' with 'share', width: 13, height: 13 -%}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- if help_page != blank -%}
|
||||||
|
<button is="toggle-button" class="product-meta__help link text--subdued hidden-tablet-and-up" aria-controls="product-{{ section.id }}-help-popover" aria-expanded="false">{{ 'product.general.need_help' | t }}</button>
|
||||||
|
<button is="toggle-button" class="product-meta__help link text--subdued hidden-phone" aria-controls="product-{{ section.id }}-help-drawer" aria-expanded="false">{{ 'product.general.need_help' | t }}</button>
|
||||||
|
{%- endif -%}
|
||||||
|
</div>
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- if help_page != blank -%}
|
||||||
|
{%- comment -%}Drawer for tablet and higher{%- endcomment -%}
|
||||||
|
<drawer-content id="product-{{ section.id }}-help-drawer" class="drawer drawer--large hidden-phone">
|
||||||
|
<span class="drawer__overlay"></span>
|
||||||
|
|
||||||
|
<header class="drawer__header">
|
||||||
|
<p class="drawer__title heading h6">{{ help_page.title }}</p>
|
||||||
|
|
||||||
|
<button type="button" class="drawer__close-button tap-area" data-action="close" title="{{ 'general.accessibility.close' | t | escape }}">
|
||||||
|
{%- render 'icon' with 'close' -%}
|
||||||
|
</button>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="drawer__content drawer__content--padded-start">
|
||||||
|
<div class="rte">
|
||||||
|
{{- help_page.content -}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</drawer-content>
|
||||||
|
|
||||||
|
{%- comment -%}Popover for mobile{%- endcomment -%}
|
||||||
|
<popover-content hidden id="product-{{ section.id }}-help-popover" class="popover hidden-lap-and-up">
|
||||||
|
<span class="popover__overlay"></span>
|
||||||
|
|
||||||
|
<header class="popover__header">
|
||||||
|
<p class="popover__title heading h6">{{ help_page.title }}</p>
|
||||||
|
|
||||||
|
<button type="button" class="popover__close-button tap-area tap-area--large" data-action="close" title="{{ 'general.accessibility.close' | t | escape }}">
|
||||||
|
{%- render 'icon' with 'close' -%}
|
||||||
|
</button>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="popover__content">
|
||||||
|
<div class="rte">
|
||||||
|
{{- help_page.content -}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</popover-content>
|
||||||
|
{%- endif -%}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Script to auto update variant price on variant change, on product page -->
|
||||||
|
<script>
|
||||||
|
function ALVariantChanged() {
|
||||||
|
var autolabelVariants = [];
|
||||||
|
|
||||||
|
{% for variant in product.variants %}
|
||||||
|
{% assign raw_variant_price = variant.metafields.app--168074346497.auto_discounted_price.value | default: variant.price %}
|
||||||
|
|
||||||
|
{% if variant.metafields.app--168074346497.auto_discounted_price.value and variant.metafields.app--168074346497.discount_type.value != "fixed" and product.metafields.app--168074346497.discount_percentage.value > 0.005 %}
|
||||||
|
{% assign deducted_percentage = 1.0 | minus: product.metafields.app--168074346497.discount_percentage.value %}
|
||||||
|
|
||||||
|
{% if variant.metafields.app--168074346497.discount_percentage.value > 0.005 %}
|
||||||
|
{% assign deducted_percentage = 1.0 | minus: variant.metafields.app--168074346497.discount_percentage.value %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% assign raw_variant_price = variant.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil %}
|
||||||
|
{% elsif shop.metafields.app--168074346497.discount_percentage.value > 0.005 %}
|
||||||
|
{% assign deducted_percentage = 1.0 | minus: shop.metafields.app--168074346497.discount_percentage.value %}
|
||||||
|
{% assign raw_variant_price = variant.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% assign raw_variant_compare_at_price = variant.price %}
|
||||||
|
|
||||||
|
{% if variant.compare_at_price and variant.compare_at_price > variant.price %}
|
||||||
|
{% assign raw_variant_compare_at_price = variant.compare_at_price %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% assign raw_variant_price_money = raw_variant_price | money_with_currency %}
|
||||||
|
{% assign raw_variant_compare_at_price_money = raw_variant_compare_at_price | money_with_currency %}
|
||||||
|
|
||||||
|
autolabelVariants.push({id: "{{ variant.id }}", raw_price: "{{ raw_variant_price }}", price: `{{ raw_variant_price_money }} CAD`, compare_at_price: `{{ raw_variant_compare_at_price_money }} CAD`});
|
||||||
|
{% endfor %}
|
||||||
|
console.log("auto label variant");
|
||||||
|
console.debug(autolabelVariants);
|
||||||
|
|
||||||
|
var currentId = document.querySelector(".product__content input[name='id']")?.value;
|
||||||
|
|
||||||
|
const searchedVariant = autolabelVariants.find((element) => currentId && element.id == currentId);
|
||||||
|
|
||||||
|
const alOriginalPrice = document.querySelector('[data-compare-at-price-yagi]');
|
||||||
|
const alDiscountedPrice = document.querySelector('[data-price-yagi]');
|
||||||
|
|
||||||
|
if(searchedVariant && alOriginalPrice && alDiscountedPrice){
|
||||||
|
alOriginalPrice.textContent = searchedVariant.compare_at_price.replace(/<[^>]*>/g, '');
|
||||||
|
alDiscountedPrice.textContent = searchedVariant.price.replace(/<[^>]*>/g, '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", (event) => {
|
||||||
|
document.querySelector("form input[name='id']")?.addEventListener('change', ALVariantChanged);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
Reference in new issue
Block a user