{ return value != '' }) if(everythingSelected) { allOptionsSelected = true } this.optionValues = this.optionValues.join('-'); if( this.optionValues ){ this.variantHandle = this.optionValues; } if(this.allOptionsSelected) { const options1 = document.querySelectorAll('button[id="' 'option-1' '"]') const options2 = document.querySelectorAll('button[id="' 'option-2' '"]') const options3 = document.querySelectorAll('button[id="' 'option-3' '"]') const selectSelector1 = document.querySelector('select[name="' 'select-option-1' '"]') const selectSelector2 = document.querySelector('select[name="' 'select-option-2' '"]') const selectSelector3 = document.querySelector('select[name="' 'select-option-3' '"]') if(this.variants[this.variantHandle]) { const optionsLength = 1 let currentObj; let optionNumber; if(optionsLength === 1) { optionNumber = 1; currentObj = Object.entries(this.variants); } else if (optionsLength === 2) { optionNumber = 2 currentObj = Object.entries(this.variants).filter(([key]) => key.includes(this.variants[this.variantHandle][0].option1)) } else { optionNumber = 3 currentObj = Object.entries(this.variants).filter(([key]) => key.includes(this.variants[this.variantHandle][0].option1 '-' this.variants[this.variantHandle][0].option2)) } if(options1 && options1.length > 0) { for (let option of options1) { if(option.classList.contains('strikethrough')) { option.classList.remove('strikethrough') } } } else if(selectSelector1 && selectSelector1.length > 0) { for (let option of selectSelector1) { if(option.text.includes(' - SOLD OUT')) { option.text = option.text.replace(' - SOLD OUT','') } } } if(options2 && options2.length > 0) { for (let option of options2) { if(option.classList.contains('strikethrough')) { option.classList.remove('strikethrough') } } } else if(selectSelector2 && selectSelector2.length > 0) { for (let option of selectSelector2) { if(option.text.includes(' - SOLD OUT')) { option.text = option.text.replace(' - SOLD OUT','') } } } if(options3 && options3.length > 0) { for (let option of options3) { if(option.classList.contains('strikethrough')) { option.classList.remove('strikethrough') } } } else if(selectSelector3 && selectSelector3.length > 0) { for (let option of selectSelector3) { if(option.text.includes(' - SOLD OUT')) { option.text = option.text.replace(' - SOLD OUT','') } } } currentObj.forEach((variant) => { let option1 = variant[1][0].option1 let option2 = variant[1][0].option2 let option3 = variant[1][0].option3 let dropdownOption1; let dropdownOption2; let dropdownOption3; if(selectSelector1) { dropdownOption1 = selectSelector1.querySelector('option[value="' option1 '"]'); } if(selectSelector2) { dropdownOption2 = selectSelector2.querySelector('option[value="' option2 '"]'); } if(selectSelector3) { dropdownOption3 = selectSelector3.querySelector('option[value="' option3 '"]'); } const selector1 = document.querySelector('button[name="' option1 '"]') const selector2 = document.querySelector('button[name="' option2 '"]') const selector3 = document.querySelector('button[name="' option3 '"]') if(optionNumber === 1) { if(!variant[1][0].available) { if(selector1) { selector1.classList.add('strikethrough') } else { dropdownOption1.text = dropdownOption1.text ' - SOLD OUT' } } } else if (optionNumber === 2) { if(!variant[1][0].available) { if(selector1) { selector1.classList.add('strikethrough') } else { dropdownOption1.text = dropdownOption1.text ' - SOLD OUT' } if(selector2) { selector2.classList.add('strikethrough') } else { dropdownOption2.text = dropdownOption2.text ' - SOLD OUT' } } if(this.variants[this.variantHandle][0].available) { if(selector1) { selector1.classList.remove('strikethrough') } else { dropdownOption1.text = dropdownOption1.text.replace(' - SOLD OUT','') } } } else { if(!variant[1][0].available) { if(selector1) { selector1.classList.add('strikethrough') } else { dropdownOption1.text = dropdownOption1.text ' - SOLD OUT' } if(selector2) { selector2.classList.add('strikethrough') } else { dropdownOption2.text = dropdownOption2.text ' - SOLD OUT' } if(selector3) { selector3.classList.add('strikethrough') } else { dropdownOption3.text = dropdownOption3.text ' - SOLD OUT' } } if(this.variants[this.variantHandle][0].available) { if(selector1) { selector1.classList.remove('strikethrough') } else { dropdownOption1.text = dropdownOption1.text.replace(' - SOLD OUT','') } if(selector2) { selector2.classList.remove('strikethrough') } else { dropdownOption2.text = dropdownOption2.text.replace(' - SOLD OUT','') } } } }) } else { if(options1 && options1.length > 0) { for (let option of options1) { if(option.classList.contains('strikethrough')) { option.classList.remove('strikethrough') } } } else if(selectSelector1 && selectSelector1.length > 0) { for (let option of selectSelector1) { if(option.text.includes(' - SOLD OUT')) { option.text = option.text.replace(' - SOLD OUT','') } } } if(options2 && options2.length > 0) { for (let option of options2) { if(option.classList.contains('strikethrough')) { option.classList.remove('strikethrough') } } } else if(selectSelector2 && selectSelector2.length > 0) { for (let option of selectSelector2) { if(option.text.includes(' - SOLD OUT')) { option.text = option.text.replace(' - SOLD OUT','') } } } if(options3 && options3.length > 0) { for (let option of options3) { if(option.classList.contains('strikethrough')) { option.classList.remove('strikethrough') } } } else if(selectSelector3 && selectSelector3.length > 0) { for (let option of selectSelector3) { if(option.text.includes(' - SOLD OUT')) { option.text = option.text.replace(' - SOLD OUT','') } } } optionsArrray.forEach((opt) => { const optionButton = document.querySelector('button[name="' opt '"]') if(optionButton) { optionButton.classList.add('strikethrough') } }) const selectors = document.querySelectorAll('button[id="' 'option-3' '"]') if(selectors && selectors.length > 0) { selectors.forEach((selector) => { selector.classList.add('strikethrough') }) } else if(selectSelector3 && selectSelector3.length > 0) { for (let i = 0; i < selectSelector3.length; i ) { if(i != 0) selectSelector3[i].text = selectSelector3[i].text ' - SOLD OUT' } } } } // update defaults from variant data if (this.variants[this.variantHandle]){ this.defaultVariantExists = true; this.buttonDisabled = false; this.defaultAvailable = this.variants[this.variantHandle][0].available; this.defaultVariantPrice = this.variants[this.variantHandle][0].price; this.defaultVariantPriceMin = this.variants[this.variantHandle][0].price; this.defaultVariantComparePrice = this.variants[this.variantHandle][0].comparePrice; this.defaultVariantUnitPrice = this.variants[this.variantHandle][0].unitPrice; this.defaultVariantUnitLabel = this.variants[this.variantHandle][0].unitLabel; this.defaultVariantId = this.variants[this.variantHandle][0].id; this.defaultVariantSKU = this.variants[this.variantHandle][0].sku; this.defaultVariantfeaturedMedia = this.variants[this.variantHandle][0].featuredMedia; this.defaultHasSellingPlan = this.variants[this.variantHandle][0].hasSellingPlan; this.defaultRequiresSellingPlan = this.variants[this.variantHandle][0].requiresSellingPlan; this.variantTitle = this.variants[this.variantHandle][0].title; this.storesAvailable = this.variants[this.variantHandle][0].storesAvailable; this.sellingGroupIds = this.variants[this.variantHandle][0].sellingGroupIds; this.allOptionsSelected = true; } else { this.defaultVariantExists = false; } // check if subscription is selected if (this.defaultHasSellingPlan && this.sellingGroupId) { let sellingPlanInput = formContainer.querySelector('input[name="' this.sellingGroupId '_' this.defaultVariantId '_selling_plan' '"]:checked'); if(!sellingPlanInput) { sellingPlanInput = formContainer.querySelector('input[name="' this.sellingGroupId '_' this.defaultVariantId '_selling_plan' '"]'); } if (sellingPlanInput == null) { this.buttonDisabled = true; } else { let sellingPlanData = JSON.parse(sellingPlanInput.getAttribute('data-selling-plan')); // update selling plan id this.defaultSellingPlanId = sellingPlanInput.value; // update defaults from selling plan data this.defaultSellingPlanPrice = sellingPlanData.price; this.defaultVariantPrice = sellingPlanData.price; this.defaultVariantComparePrice = sellingPlanData.compare_at_price; this.defaultVariantUnitPrice = sellingPlanData.unit_price; this.defaultRecurringDeliveries = sellingPlanData.recurring_deliveries; this.defaultSellingPlanName = sellingPlanData.name '.'; this.defaultSellingPlanDescription = sellingPlanData.description; // loop through pricing adjustments and display summary this.defaultSavingsSummary = ''; let savingSummary = ''; let savingHighlight = ''; sellingPlanData.price_adjustments.forEach(function (price_adjustment, index, array) { let savingValue = price_adjustment.value; if (savingValue > 0) { let savingsPercentLabel; let savingsCount; let punctionation; let sentanceStart; if (price_adjustment.value_type == 'percentage') { savingsPercentLabel = '%'; } if (price_adjustment.value_type == 'price') { savingsPercentLabel = ''; savingValue = Shopify.formatMoney(sellingPlanData.compare_at_price - savingValue, currency_symbol, true, 'amount', '100'); } if (price_adjustment.value_type == 'fixed_amount') { savingsPercentLabel = ''; savingValue = Shopify.formatMoney(savingValue, currency_symbol, true, 'amount', '100'); } if (price_adjustment.order_count == null) { savingsCount = 'ongoing'; } else { savingsCount = price_adjustment.order_count; } if (index === 0) { punctionation = '. '; sentanceStart = 'Save ' savingHighlight = '· Save ' savingValue savingsPercentLabel; } else { sentanceStart = 'Save ' } if (index === (array.length -1)) { punctionation = '. '; } if (price_adjustment.value_type == 'price') { sentanceStart = '' savingHighlight = ' · Save ' savingValue savingsPercentLabel; } savingSummary = sentanceStart savingValue savingsPercentLabel ' for ' savingsCount ' order(s)' punctionation; } }); this.defaultSavingsSummary = savingSummary; this.defaultSavingsHighlight = savingHighlight } } else { this.defaultSellingPlanName = ''; this.defaultSellingPlanId = 0; let sellingPlanInput = formContainer.querySelector('select[name="selling_plan"]'); if(sellingPlanInput) { sellingPlanInput.value = 0; } } // updated calculated price this.calculatedPrice = this.quantity * this.defaultVariantPrice; // sort featured variant image to front if (!this.buttonDisabled) { if (this.defaultVariantfeaturedMedia && !quickAdd){ let featuredImages = formContainer.querySelectorAll('.' this.defaultVariantfeaturedMedia); this.scrollToIndex(featuredImages[0].dataset.slide) } } if(!quickAdd) { // update url with variant parameter let searchParams = new URLSearchParams(window.location.search); searchParams.set('variant', this.defaultVariantId); let newRelativePathQuery = window.location.pathname '?' searchParams.toString(); history.replaceState(null, '', newRelativePathQuery); } // update local pickup block let pickupContainer = formContainer.querySelector('.js\\:pickup'); if (pickupContainer) { fetch(window.location '§ion_id=product__pickup') .then( async (response) => { let data = await response.text(); if (response.status === 200) { let html = document.createElement('div'); html.innerHTML = data; let htmlCleaned = html.querySelector('.js\\:pickup'); if(htmlCleaned){ pickupContainer.innerHTML = htmlCleaned.innerHTML; } } else { console.error('Error:', error); } }) .catch((error) => { console.error('Error:', error); }); } // trigger change of form name=id element let select = document.getElementById('Variants-template--21778313118018__1638995507af787164'); let changeEvent = new Event('change', { bubbles: true }); if (select){ setTimeout(function() { select.dispatchEvent(changeEvent); }, 100); } }, initForm() { // add listener to form let formContainer = this.$refs.formContainer; let forms = formContainer.querySelectorAll('form'); for (const form of forms) { if(form.className.includes('shopify-product-form')) form.setAttribute(this.attributeName, this.attributeValue); form.setAttribute('x-on:keydown.enter.prevent', ''); } // update default options if ?variant is present if (window.location.href.indexOf('??variant=') > -1) { this.title = 'default-title'; this.handleForm(); } else { // enable form for single variant products if (this.variantCount == 1 && this.optionsCount <= 1) { this.handleForm(); } // enable form for multi variants else { // set first variant as default this.defaultVariantId = 47659710251330; this.defaultAvailable = true; this.handleForm(false, 47659710251330); } } } }" x-init="initForm(); checkLineItems('djeco-jewellery-kit-pearls-and-birds');" x-ref="formContainer">
Jewellery Kit Pearls and Birds is a themed make your own jewellery kit that offers a stylish craft activity gift for children. Beautifully designed, there are 4 screw top pots of pretty beads, 5 coloured ribbons, jewellery elastic, a selection of special bird and butterfly beads and lockets to transform into necklaces and bracelets.With its detailed picture instruction book, stylish packaging and inspiring contents, this Djeco Jewellery Kit will be very well received particularly as a ready to wear illustrated locket on a coloured chain is included too! Make stylish jewellery gift set
Simple ideas for setting bracelets and necklaces without needing clasps
4 screw top pots of beads
5 colours of ribbon and jewellery elastic
Selection of special bird and butterfly beads and lockets for adding finishing touches
Ready to wear illustrated locket on a coloured chain included