Made By Hand Online – British Handmade Contemporary Craft & Gifts

Made By Hand Online – British Handmade Contemporary Craft & Gifts

mbho social
Made By Hand Online – British Handmade Contemporary Craft & Gifts conformetedPrice){ $(‘#product-price’).html(`${formattedPrice}${comPrice}`); }else{ $(‘#product-price’).text(formattedPrice); } // Enable or disable the Add to Cart button. $(‘#add-to-cart’).attr(‘disabled’, variant.available ? null : ‘disabled’); // Update the featured image. if(variant.featured_image) { //=============================================================== //Slick Product Gallery Variant Swapping – Added by Keeping Shop //slideIndex = parseInt(variant.featured_image.position) – 1; //console.log(variant); //console.log(null); var productImages = null; var varianttmpimagesrc = variant.featured_image.src.replace(/^https?:/i, “”); var variantimagesrc = varianttmpimagesrc.split(“?”)[0]; var cleanproductImages = []; $.each(productImages, function(){ cleanproductImages.push(this.split(“?”)[0]); }); slideIndex = $.inArray( variantimagesrc, cleanproductImages ); //var firstInit = false; //var currentselectedoption = $(“#product-select-option-0”)[0].selectedIndex; $(‘#product-select-option-0’).on(‘change’, function(e) { var slider = $( ‘.slider-for’ ); slider[0].slick.slickGoTo(parseInt(slideIndex)); slider[0].slick.slickPause(); }); // end of Variant Swapping //=============================================================== var sizedImageUrl = Shopify.Image.getSizedImageUrl(variant.featured_image.src, ‘master’); $(‘#featured-image’).attr(‘src’, sizedImageUrl); } }; // Instantiate the option selectors. var optionSelectors = new Shopify.OptionSelectors(“product-select”, { product: null, onVariantSelected: onVariantSelected, enableHistoryState: true }); // Create an event listener to set a specific variant when clicking on image thumbnails. $(document).on(‘click’, ‘[data-change-variant]’, function(e) { e.preventDefault(); optionSelectors.selectVariant($(this).data(‘changeVariant’)); console.log($(this)); }); // Create an event listener to set a specific variant option when clicking on swatches. $(document).on(‘click’, ‘[data-change-option]’, function(e) { e.preventDefault(); var optionIndex = parseInt($(this).data(‘changeOption’)), optionValue = $(this).data(‘changeValue’); if(optionSelectors.optionExistInSelect(optionSelectors.selectors[optionIndex].element, optionValue)) { $(optionSelectors.selectors[optionIndex].element).val(optionValue).trigger(‘change’); } }); // Remove the JS flag on the body. $(‘body’).removeClass(‘no-js’); }(jQuery)); ]]>‘, /* Code that is used as previous icon */ nextIcon: ‘arrow right‘, /* Code that is used as next icon */ }); ]]>

Source

Leave a Reply