Linked options not working on Product Page, How to fix in 'Flex Theme by Out of the Sand Box'

Shopify Partner
20 0 0

Hi Everyone,

I've seen in numerous threads on this discussion board about hiding variants that are sold out.

I'm finding this quite the issue, as I have products with multiple variants. However, every option is not always in-stock, so it would be good for those to be hidden, otherwise, how is a customer to know without trying multiple combinations of variants before finding what's available.

This, to me, is a huge unfriendly user experience and something I would've thought a company as big as Shopify would've addressed already.

 

I see that there's documentation for this issue:

https://help.shopify.com/en/themes/customization/products/variants/link-product-options-in-menus

https://help.shopify.com/en/themes/customization/products/variants/hide-variants-that-are-sold-out

 

After apply the documented code it hide the '1st Option' sold out color but it didn't hide the '2nd Option' sold out color.  See the screenshot below:

linked-option-error.jpg

But Still i didn't get any solution. I am using 'Flex' theme by 'Out of The Sandbox'.

 

Script Code:

-----------------

<script>
// (c) Copyright 2016 Caroline Schnapp. All Rights Reserved. Contact: mllegeorgesand@gmail.com
// See https://docs.shopify.com/themes/customization/navigation/link-product-options-in-menus

// Modified by Jonathan Moore (Style Hatch) https://github.com/jonathanmoore
/*
Updated to work with sectioned themes
- Added required methods from the deprecated options_selection.js
- Triggers an initial variant change
- Hides sold out variants with only one option
*/
window.addEventListener('DOMContentLoaded', function() {
var Shopify = Shopify || {};

// Required functionality from depricated options_selection.js
Shopify.arrayIncludes = function(e, t) {
for (var n = 0; n < e.length; n++)
if (e[n] == t) return !0;
return !1
}, Shopify.uniq = function(e) {
for (var t = [], n = 0; n < e.length; n++) Shopify.arrayIncludes(t, e[n]) || t.push(e[n]);
return t
}
Shopify.optionsMap = {};
Shopify.updateOptionsInSelector = function(selectorIndex) {

switch (selectorIndex) {
case 0:
var key = 'root';
var selector = jQuery('.single-option-selector__radio:eq(0)');
break;
case 1:
var key = jQuery('.single-option-selector__radio:eq(0)').val();
var selector = jQuery('.single-option-selector__radio:eq(1)');
break;
case 2:
var key = jQuery('.single-option-selector__radio:eq(0)').val();
key += ' / ' + jQuery('.single-option-selector__radio:eq(1)').val();
var selector = jQuery('.single-option-selector__radio:eq(2)');
}

var initialValue = selector.val();
selector.empty();
var availableOptions = Shopify.optionsMap[key];
for (var i=0; i<availableOptions.length; i++) {
var option = availableOptions[i];
var newOption = jQuery('<option></option>').val(option).html(option);
selector.append(newOption);
}
jQuery('.swatch[data-option-index="' + selectorIndex + '"] .swatch-element').each(function() {
if (jQuery.inArray($(this).attr('data-value'), availableOptions) !== -1) {
$(this).removeClass('soldout').show().find(':radio').removeAttr('disabled','disabled').removeAttr('checked');
}
else {
$(this).addClass('soldout').hide().find(':radio').attr('disabled','disabled');
}
});
if (jQuery.inArray(initialValue, availableOptions) !== -1) {
selector.val(initialValue);
}
selector.trigger('change');

};
Shopify.linkOptionSelectors = function(product) {
// Building our mapping object.
for (var i=0; i<product.variants.length; i++) {
var variant = product.variants[i];
if (variant.available) {
// Gathering values for the 1st drop-down.
Shopify.optionsMap['root'] = Shopify.optionsMap['root'] || [];
Shopify.optionsMap['root'].push(variant.option1);
Shopify.optionsMap['root'] = Shopify.uniq(Shopify.optionsMap['root']);
// Gathering values for the 2nd drop-down.
if (product.options.length > 1) {
var key = variant.option1;
Shopify.optionsMap[key] = Shopify.optionsMap[key] || [];
Shopify.optionsMap[key].push(variant.option2);
Shopify.optionsMap[key] = Shopify.uniq(Shopify.optionsMap[key]);
}
// Gathering values for the 3rd drop-down.
if (product.options.length === 3) {
var key = variant.option1 + ' / ' + variant.option2;
Shopify.optionsMap[key] = Shopify.optionsMap[key] || [];
Shopify.optionsMap[key].push(variant.option3);
Shopify.optionsMap[key] = Shopify.uniq(Shopify.optionsMap[key]);
}
}
}
// Update options right away.
Shopify.updateOptionsInSelector(0);
if (product.options.length > 1) Shopify.updateOptionsInSelector(1);
if (product.options.length === 3) Shopify.updateOptionsInSelector(2);
// When there is an update in the first dropdown.
jQuery(".single-option-selector__radio:eq(0)").change(function() {
Shopify.updateOptionsInSelector(1);
if (product.options.length === 3) Shopify.updateOptionsInSelector(2);
return true;
});
// When there is an update in the second dropdown.
jQuery(".single-option-selector__radio:eq(1)").change(function() {
if (product.options.length === 3) Shopify.updateOptionsInSelector(2);
return true;
});
};

{% if product.available and product.options.size > 1 %}
var $addToCartForm = $('form[action="/cart/add"]');
if (window.MutationObserver && $addToCartForm.length) {
if (typeof observer === 'object' && typeof observer.disconnect === 'function') {
observer.disconnect();
}
var config = { childList: true, subtree: true };
var observer = new MutationObserver(function() {

observer.disconnect();
});
observer.observe($addToCartForm[0], config);
}
{% endif %}
Shopify.linkOptionSelectors({{ product | json }});

var selector = jQuery('.single-option-selector__radio:eq(0)');
selector.trigger('change');
{% if product.options.size == 1 %}
{% for variant in product.variants %}
{% unless variant.available %}
jQuery('.single-option-selector__radio option').filter(function() { return jQuery(this).text().trim() === {{ variant.title | json }}; }).remove();
{% endunless %}
{% endfor %}
jQuery('.single-option-selector__radio').trigger('change');
{% endif %}
});
</script>

----------------

 

Please help me to fix this issue.

Thanks in advanced.

 

Muneeb

0 Likes
Shopify Partner
571 123 188

@Muneeb1 

 

Send me your store url so I can check and assist you better.

 

Thank you,

Tejas

Shopify Expert | Skype: tejas.nadpara
- Like and Mark as an Accepted Solution if reply helpful
- Feel free to contact me on support@hexaecommerce.com regarding any help
0 Likes
Shopify Partner
20 0 0

@Tejas_Nadpara 

 

Thanks for the reply.

 

Please see below our store url to view theme:
https://ih8duqns3m9md101-6710621.shopifypreview.com

 

Try to search the product name 'Cross Hatch Forward Thinking Short Sleeve Tee Shirt' and you will get the issue that i am facing.

 

Thank you

Muneeb

0 Likes
Shopify Partner
20 0 0

Anyone get any solution for Sectioned Theme?

0 Likes
Highlighted
New Member
2 0 0

Hi, I am also facing the similar issue on product page. Its saying Shopify.linkOptionSelectors is not a function.

 

 

  Please help.

 

https://www.earthgarden.in/

 

Link-option-selector-error.png

0 Likes
New Member
1 0 0

We're am facing a similar issue. However, ours is hiding options even though they are in stock. If you go to https://petsgohere.com/products/advantage-ii-flea-treatment-dogs-cats 6 months and 12 months should be showing for each of our Cat weights but it appears to only show for dogs. I believe the issue has to do with our bold-variant snippet can anyone give as a solution to this issue?

 

{%- comment -%}
BOLD-VARIANT.LIQUID
Last updated: 2017-Sep-21

Sets all appropriate liquid varaibles for Bold Apps that affect the variant.
Creates an updated JSON object that includes key information relating to our apps.
Combines the functionality of bold-hidden-variants, bold-base-variant and bold-variant-inventory

FLAGS:
  base_product:      {product object}                          Base product object for the variant, used to check/set several properties. If not supplied, defaults to bold_product. If no bold_product is set, defaults to product
  line_item:         {line item object} | null (default)       If set, pass the line item to the included snippets - some apps may adjust prices differently depending on whether we're influencing the cart total or not
  output:            'json' | 'none'  (default)                Controls whether anything is printed to the DOM
  hide_action:       'skip' | 'none'  (default)                Forces a 'continue' to skip hidden variants when 'skip' is set
  customer_tag:      {string} | null (default)                 If set, forces bold-variant to calculate as though the customer had the specified tag
  price_style:       'json' | null (default)                   If set, sets prices as '10.00' instead of 1000
  custom_app_list:   {string} | null (default)                 List of apps to apply to the price. Associated snippets will be automatically included.  If not specified, will check for a shop metafield to get a list of all relevant apps that need to be included.
  third_party_check: false | true (default)                    If true, runs additional checks that we know about to be compatible with third-party apps
  addional_includes: {string} | null (default)                 Additional snippets that need to be included after the initial liquid variable assignments (comma-delimited)

{%- endcomment -%}

{%- comment -%}
============================================================================================================
    ASSIGN LIQUID VARIABLES
============================================================================================================
{%- endcomment -%}


{%- comment -%} Assign flags to their default values if not set {%- endcomment -%}

{%- assign bold_variant = bold-variant | default: variant -%}
{%- assign bold_variant_line_item = line_item | default: false -%}
{%- assign bold_variant_base_product = base_product | default: bold_product | default: bold_variant_line_item.product | default: product | default: item.product | default: item -%}
{%- assign bold_variant_output = output | default: 'none' -%}
{%- assign bold_variant_hide_action = hide_action | default: 'none' -%}
{%- assign bold_variant_customer_tag = customer_tag | default: csp_customer_tag -%}

{%- assign app_list = '' -%}
{%- if app_list != blank and custom_app_list != blank -%}
  {%- assign bold_variant_app_list = app_list | append: ',' | append: custom_app_list -%}
{%- else -%}
  {%- assign bold_variant_app_list = app_list | default: custom_app_list | default: false -%}
{%- endif -%}

{%- assign bold_variant_price = bold_variant.price -%}

{%- if bold_variant_app_list -%}

  {%- assign bold_variant_app_list = bold_variant_app_list | split: ',' -%}
  {%- for app in bold_variant_app_list -%}
    {%- assign snippet_title = 'bold-' | append: app | append: '-variant' -%}
    {%- capture silence_output -%}
        {%- include snippet_title with bold_variant, base_product: bold_variant_base_product, line_item: bold_variant_line_item, customer_tag: bold_variant_customer_tag -%}
    {%- endcapture -%}
  {%- endfor -%}

{%- endif -%}


{%- comment -%} Find the base variant and base variant's inventory {%- endcomment -%}

{%- assign bold_base_variant_id = bold_variant.metafields.shappify_csp['csp_base'] | default: bold_variant.metafields.shappify_qb['qb_parent'] | default: bold_variant.metafields.shappify_bundle['bundle_parent'] | default: bold_variant.id -%}

{%- comment -%} Make sure we can find the indicated base variant! {%- endcomment -%}
{%- assign bold_is_base_variant = true -%}
{%- assign bold_base_variant = bold_variant -%}
{%- unless bold_base_variant_id == bold_variant.id -%}
  {%- for variant_check in bold_variant_base_product.variants -%}
    {%- if variant_check.id == bold_base_variant_id -%}
      {%- assign bold_base_variant = variant_check -%}
      {%- assign bold_is_base_variant = false -%}
      {%- break -%}
    {%- endif -%}
  {%- endfor -%}
{%- endunless -%}

{%- comment -%} Assign inventory variables (based on the base_variant, if different from the current variant) {%- endcomment -%}
{%- assign target_variant_inventory_quantity = bold_base_variant.inventory_quantity -%}
{%- assign target_variant_inventory_policy = bold_base_variant.inventory_policy -%}

{%- assign bold_variant_cart_quantity = 0 -%}
{%- for inv_check_item in cart.items -%}
  {%- assign cart_variant = inv_check_item.variant -%}
  {%- assign cart_base_variant_id = cart_variant.metafields.shappify_csp['csp_base'] | default: cart_variant.metafields.shappify_qb['qb_parent'] | default: cart_variant.metafields.shappify_bundle['bundle_parent'] | default: cart_variant.id -%}
  {%- if cart_base_variant_id == bold_base_variant_id -%}
    {%- assign bold_variant_cart_quantity = bold_variant_cart_quantity | plus: inv_check_item.quantity -%}
  {%- endif -%}
{%- endfor -%}

{%- assign bold_variant_inventory_quantity =  bold_base_variant.inventory_quantity  -%}
{%- assign bold_variant_remaining_quantity = bold_variant_inventory_quantity | minus: bold_variant_cart_quantity -%}
{%- assign bold_variant_inventory_policy = bold_base_variant.inventory_policy -%}
{%- assign bold_variant_inventory_management = bold_base_variant.inventory_management -%}

{%- comment -%} Now that we've established quantity, re-evaluate the variant's availablility {%- endcomment -%}
{%- if bold_variant_remaining_quantity <= 0 and bold_variant_inventory_policy == 'deny' and bold_variant_inventory_management != blank -%}
  {%- assign bold_variant_available = false -%}
{%- else -%}
  {%- assign bold_variant_available = bold_variant.available -%}
{%- endif -%}


{%- comment -%} If we're calling this from bold-cart-item, also set the max quantity the line item can go up to {%- endcomment -%}
{%- if bold_item and bold_variant_inventory_management != blank and bold_variant_inventory_policy == 'deny' -%}
  {%- assign bold_item_max_quantity = bold_item.quantity | plus: bold_variant_remaining_quantity -%}
{%- else -%}
  {%- assign bold_item_max_quantity = '' -%}
{%- endif -%}

{%- comment -%} Check for CSP visibility. Other 'hide' rules are based directly on metafields on the variants. {%- endcomment -%}

{%- assign csp_hidden = false -%}
{%- if shop.metafields.shop_csp_tag_group.shop_csp_tag or bold_variant.metafields.shappify_csp -%}
  {%- assign csp_flag_string = ' (' | append: bold_variant_customer_tag | append: ')' -%}
  {%- assign all_shop_tags = shop.metafields.shop_csp_tag_group.shop_csp_tag | append: ',default' | split: ',' -%}

  {%- unless bold_variant.metafields.shappify_csp.csp_tag == blank -%}

    {%- if bold_variant.metafields.shappify_csp.csp_tag == 'default' and bold_variant_customer_tag != 'default' -%}
      {%- if bold_variant_base_product -%}
        {%- assign found_csp_level = false -%}
        {%- for variant in bold_variant_base_product.variants -%}
           {%- if variant.metafields.shappify_csp.csp_base == bold_variant.id and variant.metafields.shappify_csp.csp_tag == bold_variant_customer_tag -%}
             {%- assign found_csp_level = true -%}
             {%- break -%}
           {%- endif -%}
        {%- endfor -%}
        {%- if found_csp_level -%}{%- assign csp_hidden = true -%}{%- endif -%}
      {%- endif -%}


    {%- elsif bold_variant_customer_tag != bold_variant.metafields.shappify_csp.csp_tag -%}
      {%- assign csp_hidden = true -%}
    {%- endif -%}
  {%- assign bold_variant_title = bold_variant.title | remove: csp_flag_string -%}
  {%- endunless -%}
{%- endif -%}

{%- comment -%} Check for QB level, hide variant and update title as appropriate {%- endcomment -%}
{%- assign qb_hidden = false -%}
{%- assign qb_level = bold_variant.metafields.shappify_qb.qb_qty | default: bold_variant.metafields.shappify_csp.csp_qty | times: 1 -%}
{%- if qb_level > 1 -%}{%- assign qb_hidden = true -%}{%- endif -%}
{%- if bold_variant.title == '1+' -%}
  {%- assign bold_variant_title = 'Default title' -%}
{%- endif -%}

{%- comment -%} If required, check for third-party Hide Rules as well {%- endcomment -%}

{%- if third_party_check == blank -%}{%- assign third_party_check = true -%}{%- endif -%}
{%- assign third_party_hidden = false -%}
{%- if third_party_check -%}
  {%- if bold_variant.title contains '% Off' or bold_variant.metafields.brodev_scn.hide == "true" or bold_variant.metafields.secomapp.freegifts or bold_variant.title contains '(Bundle price)' -%}{%- assign third_party_hidden = true%}{%- endif -%}
{%- endif -%}

{%- if csp_hidden or qb_hidden or third_party_hidden or bold_variant.metafields.shappify_bundle.is_bundle == 'true' or third_party_hidden -%}
  {%- assign bold_hidden_variant = true -%}
{%- else -%}
  {%- assign bold_hidden_variant = false -%}
{%- endif -%}

{%- assign option1_clean_name = variant.option1 | remove: csp_flag_string -%}
{%- assign option2_clean_name = variant.option2 | remove: csp_flag_string -%}
{%- assign option3_clean_name = variant.option3 | remove: csp_flag_string -%}

{%- comment -%} Check for presence of our apps {%- endcomment -%}
{%- if bold_variant.metafields.bold_measurement.formula -%}{%- assign variant_has_btm = true -%}{%- else -%}{%- assign variant_has_btm = false -%}{%- endif -%}
{%- if bold_variant.metafields.shappify_csp.csp_tag -%}{%- assign variant_has_csp = true -%}{%- else -%}{%- assign variant_has_csp = false -%}{%- endif -%}
{%- if bold_variant.metafields.shappify_qb.pricing_html or bold_variant.metafields.shappify_csp.pricing_html -%}{%- assign variant_has_qb = true -%}{%- else -%}{%- assign variant_has_qb = false -%}{%- endif -%}
{%- if bold_variant.metafields.bold_rp.rp_group_id -%}{%- assign variant_has_ro = true -%}{%- else -%}{%- assign variant_has_ro = false -%}{%- endif -%}
{%- assign bdl_check = base_product.variants | map: 'metafields' | map: 'shappify_bundle' | map: 'bundle_parent' -%}
{%- if bdl_check contains bold_variant.id -%}{%- assign variant_has_bdl = true -%}{%- else -%}{%- assign variant_has_bdl = false -%}{%- endif -%}


{%- if bold_variant_hide_action == 'skip' and bold_hidden_variant -%}{%- continue -%}{%- endif -%}

{%- if bold_variant_output == 'json' -%}
{%- comment -%}
============================================================================================================
    BEGIN JSON OUTPUT
============================================================================================================
{%- endcomment -%}
{
"id":{{- bold_variant.id | json -}},
"product_id":{{- bold_variant_base_product.id | json -}},
"product_handle":{{- bold_variant_base_product.handle | json -}},
"title":{{- bold_variant_title | default: bold_variant.title | json -}},
"option1":{%- unless option1_clean_name == blank -%}{{- option1_clean_name | json -}}{%- else -%}null{%- endunless -%},
"option2":{%- unless option2_clean_name == blank -%}{{- option2_clean_name | json -}}{%- else -%}null{%- endunless -%},
"option3":{%- unless option3_clean_name == blank -%}{{- option3_clean_name | json -}}{%- else -%}null{%- endunless -%},
"sku":{{- bold_variant.sku | json -}},
"requires_shipping":{{- bold_variant.requires_shipping | json -}},
"taxable":{{- bold_variant.taxable | json -}},
"featured_image":{%- if bold_variant.featured_image == blank -%}
null,
{%- else -%}
{
"created_at":{%- capture created_at -%}{{- bold_variant.featured_image.created_at -}}T{{- bold_variant.featured_image.created_at | date: "%T" -}}{%- endcapture -%}{{- shop.timezone -}}{{- created_at | json -}},
"id":{{- bold_variant.featured_image.id | json -}},
"position":{{- bold_variant.featured_image.position | json -}},
"product_id":{{- bold_variant.featured_image.product_id | json -}},
"src":{{- bold_variant.featured_image.src | json -}},
"updated_at":{%- capture updated_at -%}{{- bold_variant.featured_image.updated_at | date: "%F" -}}T{{- bold_variant.featured_image.updated_at | date: "%T" -}}{%- endcapture -%}{{- shop.timezone -}}{{- updated_at | json -}}
},
{%- endif -%}
"image_id":{{variant.featured_image.id | json -}},
"available":{{- bold_variant_available | json -}},
"name":{{- bold_variant_base_product.title | append: " - " | append: bold_variant.title | remove: csp_flag_string | json -}},
"options":{{- bold_variant.options | json | remove: csp_flag_string -}},
"price":{%- unless price_style == 'json' -%}{{- bold_variant_price | default: bold_variant.price | json -}}{%- else -%}{%- assign cents = bold_variant_price | default: bold_variant.price | modulo: 100 | prepend: '00' | slice: -2, 2 -%}{%- assign dollars = bold_variant_price | default: bold_variant.price | times: 0.01 | floor -%}{{- dollars | append: '.' | append: cents | json -}}{%- endunless -%},
"weight":{{- bold_variant.weight | json -}},
"compare_at_price":{%- if bold_base_variant.compare_at_price == blank -%}null{% else %}{%- unless price_style == 'json' -%}{{- bold_variant_compare_at_price | default: bold_variant.compare_at_price | json -}}{%- else -%}{%- assign cents = bold_variant_compare_at_price | default: bold_variant.compare_at_price | modulo: 100 | prepend: '00' | slice: -2, 2 -%}{%- assign dollars = bold_variant_compare_at_price | default: bold_variant.compare_at_price | times: 0.01 | floor -%}{{- dollars | append: '.' | append: cents | json -}}{%- endunless -%}{%- endif -%},
"inventory_quantity":{{- bold_variant_inventory_quantity | default: variant.inventory_quantity | json -}},
"inventory_management":{{- bold_variant_inventory_management | default: variant.inventory_management | json -}},
"inventory_policy":{{- bold_variant_inventory_policy | default: variant.inventory_policy | json -}},
"inventory_in_cart":  {{- bold_variant_cart_quantity | default: 0 | json -}},
"inventory_remaining":{{- bold_variant_remaining_quantity | default: bold_variant_inventory_quantity | default: bold_variant.inventory_quantity | json -}},
"incoming":{{- bold_variant.incoming | default: bold_base_variant.incoming | json -}},
"next_incoming_date":{{- bold_variant.next_incoming_date  | default: bold_base_variant.next_incoming_date | date: "%Y-%m-%d" | json -}},
"taxable":{%- unless bold_variant_taxable == blank -%}{{- bold_variant_taxable | json -}}{%- else -%}{{- bold_variant.taxable | json -}}{%- endunless -%},
"barcode":{{- variant.barcode | json -}}
{%- comment -%} SPECIAL HANDLING FOR CSP {%- endcomment -%}
{%- if variant_has_csp -%}
,"csp_lookup":{
{%- assign not_first_tag = false -%}
{%- for tag in all_shop_tags -%}
{%- assign found_variant = '' -%}
{%- if not_first_tag -%},{%- endif -%}{%- assign not_first_tag = true -%}
{{- tag | json -}}:
{%- for csp_variant in bold_variant_base_product.variants -%}
{%- if csp_variant.metafields.shappify_csp.csp_qty and csp_variant.metafields.shappify_csp.csp_qty != 1 -%}{%- continue -%}{%- endif -%}
{%- assign base_check = csp_variant.metafields.shappify_csp.csp_base | default: csp_variant.id%}
{%- if base_check == bold_base_variant.id and csp_variant.metafields.shappify_csp.csp_tag == tag -%}
{%- assign found_variant = csp_variant -%}
{{- break -}}
{%- endif -%}
{%- endfor -%}
{
"id":{{- found_variant.id | default: variant.id | json}},
"price":{{- found_variant.price | default: variant.price | json}}
{%- if found_variant.metafields.shappify_csp.pricing_html -%},"grid":{{- found_variant.metafields.shappify_csp.pricing_html | json -}}{%- endif -%}
}
{%- endfor -%}
}
{%- endif -%}
{%- comment -%} END OF CSP SPECIAL HANDLING {%- endcomment -%}
{%- comment -%} SPECIAL HANDLING FOR BTM {%- endcomment -%}
{%- if variant_has_btm -%}
,"btm_lookup":{{- bold_variant.metafields.bold_measurement | json -}}
{%- endif -%}
{%- comment -%} END OF BTM SPECIAL HANDLING {%- endcomment -%}
{%- comment -%} SPECIAL HANDLING FOR QB {%- endcomment -%}
{%- if variant_has_qb -%}
,"qb_lookup":{
"levels": {
{%- assign qb_price_varies = false -%}
{%- assign not_first_tag = false -%}
{%- for qb_variant in bold_variant_base_product.variants -%}
{%- if qb_variant.metafields.shappify_qb.qb_parent == bold_variant.id or qb_variant.metafields.shappify_csp.csp_base == bold_base_variant.id or qb_variant.id == bold_base_variant.id -%}
{%- if qb_variant.metafields.shappify_csp.csp_tag == blank or qb_variant.metafields.shappify_csp.csp_tag == bold_variant_customer_tag -%}
{%- if not_first_tag -%},{%- endif -%}{%- assign not_first_tag = true -%}
{%- unless qb_variant.price == bold_variant.price -%}{%- assign qb_price_varies = true -%}{%- endunless -%}
"{{- qb_variant.metafields.shappify_qb.qb_qty | default: qb_variant.metafields.shappify_csp.csp_qty | default: 1 -}}": {"id":{{- qb_variant.id -}},"price":{{- qb_variant.price -}}}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
}
{%- if qb_price_varies -%}
,"qb_price_varies": {{- qb_price_varies | json -}}
,"grid": {{- bold_variant.metafields.shappify_qb.pricing_html | default: bold_variant.metafields.shappify_csp.pricing_html | json -}}
{%- endif -%}
}
{%- endif -%}
{%- comment -%} END OF QB SPECIAL HANDLING {%- endcomment -%}
{%- comment -%} SPECIAL HANDLING FOR RO {%- endcomment -%}
{%- if variant_has_ro -%}
,"ro_lookup":{{- bold_variant.metafields.bold_rp | json | remove: 'rp_' -}}
{%- endif -%}
{%- comment -%} END OF RO SPECIAL HANDLING {%- endcomment -%}
{%- comment -%} SPECIAL HANDLING FOR BUNDLES {%- endcomment -%}
{%- if variant_has_bdl -%}
,"bdl_lookup":{
{%- for bdl_variant in base_product.variants -%}
{%- unless bold_variant.id == bdl_variant.metafields.shappify_bundle.bundle_parent -%}{%- continue -%}{%- endunless -%}
"id":{{- bdl_variant.id -}},
"price":{{- bdl_variant.price | json -}},
"bundle_group":{{- bdl_variant.metafields.shappify_bundle.bundle_group -}}
{%- break -%}
{%- endfor -%}
}
{%- endif -%}
{%- comment -%} END OF BUNDLES SPECIAL HANDLING {%- endcomment -%}
}
{%- endif -%}

 

0 Likes