$product = {"id":7937541668963,"title":"iPhone 12 mini Mod NX Jin Young Choi 番茄兄弟","handle":"iphone-12-mini-mod-nx-cjy14","description":null,"published_at":"2025-12-12T09:53:03+08:00","created_at":"2025-12-11T09:41:21+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-jychoioioi","device-iPhone 12 Mini","merge","reseller-jychoioioi"],"price":90000,"price_min":90000,"price_max":90000,"available":true,"price_varies":false,"compare_at_price":null,"compare_at_price_min":0,"compare_at_price_max":0,"compare_at_price_varies":false,"variants":[{"id":43882907664483,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-CJY14","requires_shipping":true,"taxable":true,"featured_image":{"id":34931159892067,"product_id":7937541668963,"position":18,"created_at":"2025-12-11T10:04:27+08:00","updated_at":"2025-12-11T10:04:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23deebea47951c4fc9e840e94cf7a5f94ae24685_6fc8cc11-27a1-4f47-9a47-76cea9a7d462.webp?v=1765418669","variant_ids":[43882907664483]},"available":true,"name":"iPhone 12 mini Mod NX Jin Young Choi 番茄兄弟 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118424-CJY14","featured_media":{"alt":null,"id":26493534142563,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23deebea47951c4fc9e840e94cf7a5f94ae24685_6fc8cc11-27a1-4f47-9a47-76cea9a7d462.webp?v=1765418669"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/327047ac5e5ee9fe5192141af152d6f654c12014.webp?v=1765417287","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a03be14f6d9ed3ecea02957c9608cd2203091053.webp?v=1765417288","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec3beb28df3cda7d235d70223d887fe3f6378db6.webp?v=1765417289","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf423f9f270d892acc1a1a9cd0e13d33312d5b73.webp?v=1765417289","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9e9297c40113b7032f3c9225a021e931b29dad6.webp?v=1765417290","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bcb7f6b2396f8c62b936165b4b04d2ffd4a8b7db.webp?v=1765417290","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3edbde1421eb743e31c24644e347679afb3662cf.webp?v=1765417290","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63aa8052e584fdecd1d86b759ab7a6fc51e8c9ec.webp?v=1765417291","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5fde097ebc693e53a8caa796f575e0427d004c1a.webp?v=1765417291","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23deebea47951c4fc9e840e94cf7a5f94ae24685.webp?v=1765417292","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/332662a696c9d3ccd2cf600344c110babb74b094.webp?v=1765417293","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5fde097ebc693e53a8caa796f575e0427d004c1a_bb55ed3b-b7bd-484e-8947-f5e68b42dbf6.webp?v=1765418666","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/327047ac5e5ee9fe5192141af152d6f654c12014_20c42ca0-5abc-4c0e-b488-cdac9ce0ad71.webp?v=1765418666","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec3beb28df3cda7d235d70223d887fe3f6378db6_657b9269-d346-493c-a7f2-d5913650d26f.webp?v=1765418667","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bcb7f6b2396f8c62b936165b4b04d2ffd4a8b7db_41a25318-7dea-41af-a27b-58b1d8875159.webp?v=1765418668","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf423f9f270d892acc1a1a9cd0e13d33312d5b73_cc8d2f2e-b94e-4cc0-8beb-c593c055054c.webp?v=1765418668","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3edbde1421eb743e31c24644e347679afb3662cf_4cd42545-e5d9-4676-99ce-118b70080e9e.webp?v=1765418669","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23deebea47951c4fc9e840e94cf7a5f94ae24685_6fc8cc11-27a1-4f47-9a47-76cea9a7d462.webp?v=1765418669","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63aa8052e584fdecd1d86b759ab7a6fc51e8c9ec_ba69bdba-1779-4da6-afe5-00c2433bb2b4.webp?v=1765418671","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/332662a696c9d3ccd2cf600344c110babb74b094_2c047a9b-fd79-4707-88c4-d62da20a6077.webp?v=1765418671","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a03be14f6d9ed3ecea02957c9608cd2203091053_48fe3859-ddfd-441e-b9dd-9a3ca65275c2.webp?v=1765418671","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9e9297c40113b7032f3c9225a021e931b29dad6_4868878d-a171-4f37-8d81-f09b3804bba7.webp?v=1765418672"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/327047ac5e5ee9fe5192141af152d6f654c12014.webp?v=1765417287","options":["color"],"media":[{"alt":null,"id":26493144334435,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/327047ac5e5ee9fe5192141af152d6f654c12014.webp?v=1765417287"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/327047ac5e5ee9fe5192141af152d6f654c12014.webp?v=1765417287","width":2000},{"alt":null,"id":26493144531043,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a03be14f6d9ed3ecea02957c9608cd2203091053.webp?v=1765417288"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a03be14f6d9ed3ecea02957c9608cd2203091053.webp?v=1765417288","width":2000},{"alt":null,"id":26493145022563,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec3beb28df3cda7d235d70223d887fe3f6378db6.webp?v=1765417289"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec3beb28df3cda7d235d70223d887fe3f6378db6.webp?v=1765417289","width":2000},{"alt":null,"id":26493145186403,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf423f9f270d892acc1a1a9cd0e13d33312d5b73.webp?v=1765417289"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf423f9f270d892acc1a1a9cd0e13d33312d5b73.webp?v=1765417289","width":2000},{"alt":null,"id":26493145284707,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9e9297c40113b7032f3c9225a021e931b29dad6.webp?v=1765417290"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9e9297c40113b7032f3c9225a021e931b29dad6.webp?v=1765417290","width":2000},{"alt":null,"id":26493145415779,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bcb7f6b2396f8c62b936165b4b04d2ffd4a8b7db.webp?v=1765417290"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bcb7f6b2396f8c62b936165b4b04d2ffd4a8b7db.webp?v=1765417290","width":2000},{"alt":null,"id":26493145579619,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3edbde1421eb743e31c24644e347679afb3662cf.webp?v=1765417290"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3edbde1421eb743e31c24644e347679afb3662cf.webp?v=1765417290","width":2000},{"alt":null,"id":26493145743459,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63aa8052e584fdecd1d86b759ab7a6fc51e8c9ec.webp?v=1765417291"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63aa8052e584fdecd1d86b759ab7a6fc51e8c9ec.webp?v=1765417291","width":2000},{"alt":null,"id":26493145907299,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5fde097ebc693e53a8caa796f575e0427d004c1a.webp?v=1765417291"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5fde097ebc693e53a8caa796f575e0427d004c1a.webp?v=1765417291","width":2000},{"alt":null,"id":26493146071139,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23deebea47951c4fc9e840e94cf7a5f94ae24685.webp?v=1765417292"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23deebea47951c4fc9e840e94cf7a5f94ae24685.webp?v=1765417292","width":2000},{"alt":null,"id":26493146267747,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/332662a696c9d3ccd2cf600344c110babb74b094.webp?v=1765417293"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/332662a696c9d3ccd2cf600344c110babb74b094.webp?v=1765417293","width":2000},{"alt":null,"id":26493532897379,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5fde097ebc693e53a8caa796f575e0427d004c1a_bb55ed3b-b7bd-484e-8947-f5e68b42dbf6.webp?v=1765418666"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5fde097ebc693e53a8caa796f575e0427d004c1a_bb55ed3b-b7bd-484e-8947-f5e68b42dbf6.webp?v=1765418666","width":2000},{"alt":null,"id":26493533192291,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/327047ac5e5ee9fe5192141af152d6f654c12014_20c42ca0-5abc-4c0e-b488-cdac9ce0ad71.webp?v=1765418666"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/327047ac5e5ee9fe5192141af152d6f654c12014_20c42ca0-5abc-4c0e-b488-cdac9ce0ad71.webp?v=1765418666","width":2000},{"alt":null,"id":26493533323363,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec3beb28df3cda7d235d70223d887fe3f6378db6_657b9269-d346-493c-a7f2-d5913650d26f.webp?v=1765418667"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ec3beb28df3cda7d235d70223d887fe3f6378db6_657b9269-d346-493c-a7f2-d5913650d26f.webp?v=1765418667","width":2000},{"alt":null,"id":26493533519971,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bcb7f6b2396f8c62b936165b4b04d2ffd4a8b7db_41a25318-7dea-41af-a27b-58b1d8875159.webp?v=1765418668"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bcb7f6b2396f8c62b936165b4b04d2ffd4a8b7db_41a25318-7dea-41af-a27b-58b1d8875159.webp?v=1765418668","width":2000},{"alt":null,"id":26493533749347,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf423f9f270d892acc1a1a9cd0e13d33312d5b73_cc8d2f2e-b94e-4cc0-8beb-c593c055054c.webp?v=1765418668"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf423f9f270d892acc1a1a9cd0e13d33312d5b73_cc8d2f2e-b94e-4cc0-8beb-c593c055054c.webp?v=1765418668","width":2000},{"alt":null,"id":26493533945955,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3edbde1421eb743e31c24644e347679afb3662cf_4cd42545-e5d9-4676-99ce-118b70080e9e.webp?v=1765418669"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3edbde1421eb743e31c24644e347679afb3662cf_4cd42545-e5d9-4676-99ce-118b70080e9e.webp?v=1765418669","width":2000},{"alt":null,"id":26493534142563,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23deebea47951c4fc9e840e94cf7a5f94ae24685_6fc8cc11-27a1-4f47-9a47-76cea9a7d462.webp?v=1765418669"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23deebea47951c4fc9e840e94cf7a5f94ae24685_6fc8cc11-27a1-4f47-9a47-76cea9a7d462.webp?v=1765418669","width":2000},{"alt":null,"id":26493534306403,"position":19,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63aa8052e584fdecd1d86b759ab7a6fc51e8c9ec_ba69bdba-1779-4da6-afe5-00c2433bb2b4.webp?v=1765418671"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/63aa8052e584fdecd1d86b759ab7a6fc51e8c9ec_ba69bdba-1779-4da6-afe5-00c2433bb2b4.webp?v=1765418671","width":2000},{"alt":null,"id":26493534535779,"position":20,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/332662a696c9d3ccd2cf600344c110babb74b094_2c047a9b-fd79-4707-88c4-d62da20a6077.webp?v=1765418671"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/332662a696c9d3ccd2cf600344c110babb74b094_2c047a9b-fd79-4707-88c4-d62da20a6077.webp?v=1765418671","width":2000},{"alt":null,"id":26493534732387,"position":21,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a03be14f6d9ed3ecea02957c9608cd2203091053_48fe3859-ddfd-441e-b9dd-9a3ca65275c2.webp?v=1765418671"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a03be14f6d9ed3ecea02957c9608cd2203091053_48fe3859-ddfd-441e-b9dd-9a3ca65275c2.webp?v=1765418671","width":2000},{"alt":null,"id":26493535125603,"position":22,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9e9297c40113b7032f3c9225a021e931b29dad6_4868878d-a171-4f37-8d81-f09b3804bba7.webp?v=1765418672"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9e9297c40113b7032f3c9225a021e931b29dad6_4868878d-a171-4f37-8d81-f09b3804bba7.webp?v=1765418672","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $bumper = null; $variants = [{"id":43882907664483,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-CJY14","requires_shipping":true,"taxable":true,"featured_image":{"id":34931159892067,"product_id":7937541668963,"position":18,"created_at":"2025-12-11T10:04:27+08:00","updated_at":"2025-12-11T10:04:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23deebea47951c4fc9e840e94cf7a5f94ae24685_6fc8cc11-27a1-4f47-9a47-76cea9a7d462.webp?v=1765418669","variant_ids":[43882907664483]},"available":true,"name":"iPhone 12 mini Mod NX Jin Young Choi 番茄兄弟 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118424-CJY14","featured_media":{"alt":null,"id":26493534142563,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23deebea47951c4fc9e840e94cf7a5f94ae24685_6fc8cc11-27a1-4f47-9a47-76cea9a7d462.webp?v=1765418669"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43882907664483,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-CJY14","requires_shipping":true,"taxable":true,"featured_image":{"id":34931159892067,"product_id":7937541668963,"position":18,"created_at":"2025-12-11T10:04:27+08:00","updated_at":"2025-12-11T10:04:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23deebea47951c4fc9e840e94cf7a5f94ae24685_6fc8cc11-27a1-4f47-9a47-76cea9a7d462.webp?v=1765418669","variant_ids":[43882907664483]},"available":true,"name":"iPhone 12 mini Mod NX Jin Young Choi 番茄兄弟 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118424-CJY14","featured_media":{"alt":null,"id":26493534142563,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/23deebea47951c4fc9e840e94cf7a5f94ae24685_6fc8cc11-27a1-4f47-9a47-76cea9a7d462.webp?v=1765418669"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}; $device_handle = null var sellingStatus if ($bumper) { $(document).ready(function() { var productImg = $product.images[0] var bumperVariants = $bumper.variants; var bumperColors = new Object(); var currentVariant = ''; var productType = ''; bumperVariants.forEach(variant => { bumperColors[`${variant.title.split(' (')[0].toLowerCase()}`] = variant.featured_image.src; }); if (productType === 'mod-nx-backplate' || productType === 'mod-backplate') { mergeImages( [productImg, bumperColors[currentVariant]], { crossOrigin: 'anonymous' } ).then(mergedImg => { $('.merged-img').attr('src', mergedImg); }); } else { mergeImages( [bumperColors[currentVariant], productImg], { crossOrigin: 'anonymous' } ).then(mergedImg => { $('.merged-img').attr('src', mergedImg); }); } }); }; var sellingStatusData window.fetchSellingStatus().then(data => { try { sellingStatusData = data; } catch (error) { sellingStatusData = null console.error('Unable to parse selling status', error) } $(document).ready(function() { handleSellingStatus($defaultVariant.sku); }); }) function handleSellingStatus(currentSku) { if (!sellingStatusData) { console.error('No selling status available!') return } const sellingStatusElement = document.getElementById('selling-status') const addToCartButton = document.getElementById('AddToCart-product-template') const currentProductSku = currentSku.replace(/-(.*)$/, '-') if ($variants) { const flattenedSellingStatus = [...sellingStatusData.pending, ...sellingStatusData.preorder] const matchSellingStatusProduct = flattenedSellingStatus.filter(product => currentProductSku === product.sku) if (matchSellingStatusProduct.length > 0) { const isProductPending = matchSellingStatusProduct[0].status === 'pending' const matchDate = matchSellingStatusProduct[0].date sellingStatus = isProductPending ? "缺貨中" : "預購完成出貨日:" + matchDate sellingStatusElement.textContent = sellingStatus if (sellingStatus.includes("缺貨中")){ addToCartButton.disabled ='true'; addToCartButton.textContent = "缺貨中無法加入購物車" } else { addToCartButton.textContent = "加到購物車" } } else { sellingStatusElement.textContent = '' addToCartButton.textContent = "加到購物車" }; }; }; document.addEventListener('DOMContentLoaded', function () { var currentVariantSelect = document.getElementById('SingleOptionSelector-0') currentVariantSelect.addEventListener('change', function() { var currentSku = $('#current_sku').text() var skuElement = document.getElementById('current-sku') skuElement.textContent = currentSku handleSellingStatus(currentSku) }); });
// Override default values of shop.strings for each template. // Alternate product templates can change values of // add to cart button, sold out, and unavailable states here. theme.productStrings = { addToCart: "加到購物車", soldOut: "售完", unavailable: "停產" }