').val(option).html(option);
selector.append(newOption);
}
//console.log(availableOptionsJas);
jQuery('#callBackVariant .swatches-select[data-option-index="' + selectorIndex + '"] .basel-swatch').each(function() {
//console.log('sdffsdfds');
if (jQuery.inArray($(this).attr('data-value'), availableOptions) !== -1) {
$(this).removeClass('jas_unavailable')
}
else {
$(this).addClass('jas_unavailable')
}
});
jQuery('#callBackVariant .swatches-select[data-option-index="' + selectorIndex + '"] .basel-swatch').each(function() {
//console.log('sdffsdfds');
if (jQuery.inArray($(this).attr('data-value'), availableOptionsJas) !== -1) {
$(this).removeClass('jas_soldout')
}
else {
$(this).addClass('jas_soldout')
}
});
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 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]);
}
}
if (variant.available) {
// Gathering values for the 1st drop-down.
Shopify.optionsMapJas['root'] = Shopify.optionsMapJas['root'] || [];
Shopify.optionsMapJas['root'].push(variant.option1);
Shopify.optionsMapJas['root'] = Shopify.uniq(Shopify.optionsMapJas['root']);
// Gathering values for the 2nd drop-down.
if (product.options.length > 1) {
var key = variant.option1;
Shopify.optionsMapJas[key] = Shopify.optionsMapJas[key] || [];
Shopify.optionsMapJas[key].push(variant.option2);
Shopify.optionsMapJas[key] = Shopify.uniq(Shopify.optionsMapJas[key]);
}
// Gathering values for the 3rd drop-down.
if (product.options.length === 3) {
var key = variant.option1 + ' / ' + variant.option2;
Shopify.optionsMapJas[key] = Shopify.optionsMapJas[key] || [];
Shopify.optionsMapJas[key].push(variant.option3);
Shopify.optionsMapJas[key] = Shopify.uniq(Shopify.optionsMapJas[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("#callBackVariant .single-option-selector: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("#callBackVariant .single-option-selector:eq(1)").change(function() {
if (product.options.length === 3) Shopify.updateOptionsInSelector(2);
return true;
});
};
var product = {"id": 8777391866030,"title": "P354 Raglan Long Sleeve Vest With Fuzzy Collar (Unisex)","handle": "p354-raglan-long-sleeve-vest-with-fuzzy-collar-unisex","price": 68000,"price_min": 68000,"price_max": 74000,"available": true,"price_varies": true,"compare_at_price": null,"compare_at_price_min": 0,"compare_at_price_max": 0,"compare_at_price_varies": false,"variants": [{"id": 46616268210350,"title": "xs / blk","option1": "xs","option2":"blk","option3":null,"sku": "P354-BLK-XS","requires_shipping": true,"taxable": false,"featured_image":{"id": 40047204237486,"product_id": 8777391866030,"width": 2048,"height": 2048,"src": "\/\/snorkeling-gear.com\/cdn\/shop\/files\/P354-BLK.jpg?v=1750669665"},"available": true,"public_title": "xs / blk","options": ["xs","blk"],"price": 68000,"weight": 300,"compare_at_price": null,"inventory_quantity": 9,"inventory_management": "shopify","inventory_policy": "deny","barcode": null},{"id": 46616268243118,"title": "s / blk","option1": "s","option2":"blk","option3":null,"sku": "P354-BLK-S","requires_shipping": true,"taxable": false,"featured_image":{"id": 40047204237486,"product_id": 8777391866030,"width": 2048,"height": 2048,"src": "\/\/snorkeling-gear.com\/cdn\/shop\/files\/P354-BLK.jpg?v=1750669665"},"available": true,"public_title": "s / blk","options": ["s","blk"],"price": 68000,"weight": 300,"compare_at_price": null,"inventory_quantity": 10,"inventory_management": "shopify","inventory_policy": "deny","barcode": null},{"id": 46616268275886,"title": "m / blk","option1": "m","option2":"blk","option3":null,"sku": "P354-BLK-M","requires_shipping": true,"taxable": false,"featured_image":{"id": 40047204237486,"product_id": 8777391866030,"width": 2048,"height": 2048,"src": "\/\/snorkeling-gear.com\/cdn\/shop\/files\/P354-BLK.jpg?v=1750669665"},"available": true,"public_title": "m / blk","options": ["m","blk"],"price": 68000,"weight": 300,"compare_at_price": null,"inventory_quantity": 10,"inventory_management": "shopify","inventory_policy": "deny","barcode": null},{"id": 46616268308654,"title": "l / blk","option1": "l","option2":"blk","option3":null,"sku": "P354-BLK-L","requires_shipping": true,"taxable": false,"featured_image":{"id": 40047204237486,"product_id": 8777391866030,"width": 2048,"height": 2048,"src": "\/\/snorkeling-gear.com\/cdn\/shop\/files\/P354-BLK.jpg?v=1750669665"},"available": true,"public_title": "l / blk","options": ["l","blk"],"price": 68000,"weight": 300,"compare_at_price": null,"inventory_quantity": 10,"inventory_management": "shopify","inventory_policy": "deny","barcode": null},{"id": 46616268341422,"title": "xl / blk","option1": "xl","option2":"blk","option3":null,"sku": "P354-BLK-XL","requires_shipping": true,"taxable": false,"featured_image":{"id": 40047204237486,"product_id": 8777391866030,"width": 2048,"height": 2048,"src": "\/\/snorkeling-gear.com\/cdn\/shop\/files\/P354-BLK.jpg?v=1750669665"},"available": true,"public_title": "xl / blk","options": ["xl","blk"],"price": 68000,"weight": 300,"compare_at_price": null,"inventory_quantity": 10,"inventory_management": "shopify","inventory_policy": "deny","barcode": null},{"id": 46616268374190,"title": "2xl / blk","option1": "2xl","option2":"blk","option3":null,"sku": "P354-BLK-2XL","requires_shipping": true,"taxable": false,"featured_image":{"id": 40047204237486,"product_id": 8777391866030,"width": 2048,"height": 2048,"src": "\/\/snorkeling-gear.com\/cdn\/shop\/files\/P354-BLK.jpg?v=1750669665"},"available": false,"public_title": "2xl / blk","options": ["2xl","blk"],"price": 74000,"weight": 300,"compare_at_price": null,"inventory_quantity": 0,"inventory_management": "shopify","inventory_policy": "deny","barcode": null}],"featured_image": "\/\/snorkeling-gear.com\/cdn\/shop\/files\/P354-BLK.jpg?v=1750669665","options": ["Size","Color"]};
var $addToCartForm = $('#callBackVariant 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() {
Shopify.linkOptionSelectors(product);
observer.disconnect();
});
observer.observe($addToCartForm[0], config);
}