<!-- bold-base-variant.liquid -->
{% comment %} Last updated 2016-04-22 {% endcomment %}
{% capture bold_base_variant_liquid %}
{% comment %}
BOLD-BASE-VARIANT.LIQUID - Gets the base cost, quantity, etc. of a variant
This file creates liquid variables to display the base cost of a given variant
USED BY: Customer Pricing, Quantity Breaks, Product Bundles
To use this file:
* Include this on any page where you want to display the base cost of a variant
Example: {% include 'bold-base-variant', bold_variant: variant, bold_product: product %}
* Include this page on the cart page with a cart item to generate the base price display
Example: {% include 'bold-base-variant', bold_variant: item.variant, bold_product: item.product %}
* The following helper variables are set:
bold_base_variant The base variant object for the variant given
bold_base_variant_id Contains the ID of the base variant
bold_base_variant_price The price of the item before any CSP/QB/Bundles discount
bold_is_base_variant True/False: Whether the supplied variant is the base variant or not
{% endcomment %}
{% assign bold_base_variant = bold_variant %}
{% assign bold_base_variant_price = bold_variant.price %}
{% assign bold_base_variant_id = bold_variant.id %}
{% assign bold_is_base_variant = true %}
{% if bold_variant.metafields.shappify_csp['csp_base'] != blank %}
{% assign bold_base_variant_id = bold_variant.metafields.shappify_csp['csp_base'] %}
{% elsif bold_variant.metafields.shappify_qb['qb_parent'] != blank %}
{% assign bold_base_variant_id = bold_variant.metafields.shappify_qb['qb_parent'] %}
{% elsif bold_variant.metafields.shappify_bundle['bundle_parent'] != blank %}
{% assign bold_base_variant_id = bold_variant.metafields.shappify_bundle['bundle_parent'] %}
{% endif %}
{% if bold_base_variant_id != bold_variant.id %}
{% for variant_check in bold_product.variants %}
{% if variant_check.id == bold_base_variant_id %}
{% assign bold_base_variant = variant_check %}
{% assign bold_base_variant_price = bold_base_variant.price %}
{% assign bold_is_base_variant = false %}
{% endif %}
{% endfor %}
{% endif %}
{% endcapture %}{{ bold_base_variant_liquid | strip_newlines }}