{% comment %} Renders product variant-picker Accepts: - product: {Object} product object. - block: {Object} passing the block information. - product_form_id: {String} Id of the product form to which the variant picker is associated. - update_url: {Boolean} whether or not to update url when changing variants. If false, the url isn't updated. Default: true (optional). Usage: {% render 'product-variant-picker', product: product, block: block, product_form_id: product_form_id %} {% endcomment %} {%- unless product.has_only_default_variant -%} {%- for option in product.options_with_values -%} {%- liquid assign swatch_count = option.values | map: 'swatch' | compact | size assign picker_type = block.settings.picker_type if swatch_count > 0 and block.settings.swatch_shape != 'none' if block.settings.picker_type == 'dropdown' assign picker_type = 'swatch_dropdown' else assign picker_type = 'swatch' endif endif -%} {% comment %} SHX custom code {% endcomment %} {% liquid capture shx_current_page render "shx-get-current-page" endcapture %} {% if shx_current_page contains "texte" %} {{ option.name }} {% for product_variant in product.variants %} {{ product_variant.title }} {% endfor %} {{ option.selected_value }} {% for product_variant in product.variants %} {% if option.selected_value == product_variant.title %} {% endif %} {% endfor %} {% for product_variant in product.variants %} {{ product_variant.title }} {{ product_variant.price | money }} {% endfor %} {% else %} {% comment %} Theme default code {% endcomment %} {%- if picker_type == 'swatch' -%} {{ option.name }}: {{- option.selected_value -}} {% render 'product-variant-options', product: product, option: option, block: block, picker_type: picker_type %} {%- elsif picker_type == 'button' -%} {{ option.name }} {% render 'product-variant-options', product: product, option: option, block: block, picker_type: picker_type %} {%- else -%} {{ option.name }} {%- if picker_type == 'swatch_dropdown' -%} {% render 'swatch', swatch: option.selected_value.swatch, shape: block.settings.swatch_shape %} {%- endif -%} {% render 'product-variant-options', product: product, option: option, block: block, picker_type: picker_type %} {% render 'icon-caret' %} {% endif %} {% endif %} {%- endfor -%} {%- endunless -%} {{- 'products.product.product_variants' | t -}} {%- for variant in product.variants -%} {%- liquid echo variant.title echo variant.price | money | strip_html | prepend: ' - ' if variant.available == false echo 'products.product.sold_out' | t | prepend: ' - ' endif if variant.quantity_rule.increment > 1 echo 'products.product.quantity.multiples_of' | t: quantity: variant.quantity_rule.increment | prepend: ' - ' endif if variant.quantity_rule.min > 1 echo 'products.product.quantity.minimum_of' | t: quantity: variant.quantity_rule.min | prepend: ' - ' endif if variant.quantity_rule.max != null echo 'products.product.quantity.maximum_of' | t: quantity: variant.quantity_rule.max | prepend: ' - ' endif # TODO: enable theme-check once `item_count_for_variant` is accepted as valid filter # theme-check-disable assign cart_quantity = cart | item_count_for_variant: variant.id # theme-check-enable if cart_quantity > 0 echo 'products.product.quantity.in_cart_html' | t: quantity: cart_quantity | prepend: ' - ' endif -%} {%- endfor -%} {% render 'icon-caret' %}