$product = {"id":7937554284643,"title":"iPhone 12 mini Mod NX Jin Young Choi 爬西瓜山","handle":"iphone-12-mini-mod-nx-cjy02","description":null,"published_at":"2025-12-12T09:50:49+08:00","created_at":"2025-12-11T09:44:17+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":43882957799523,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-CJY02","requires_shipping":true,"taxable":true,"featured_image":{"id":34931658293347,"product_id":7937554284643,"position":13,"created_at":"2025-12-11T10:22:42+08:00","updated_at":"2025-12-11T10:22:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4170609a85665f2c6d3dbddb03e259afa99b7eb_50507f81-f2b6-4d0b-a07d-1dbe67bc24d3.webp?v=1765419764","variant_ids":[43882957799523]},"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-CJY02","featured_media":{"alt":null,"id":26494032543843,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4170609a85665f2c6d3dbddb03e259afa99b7eb_50507f81-f2b6-4d0b-a07d-1dbe67bc24d3.webp?v=1765419764"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb8ad212d30404fd3d590f2ca89dcc73dabbec8a.webp?v=1765417463","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4628d92d39025434e732d80db35632ffa264113a.webp?v=1765417463","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a0d9327fa7db046f742a49b0b8d4b69ebc0b9ffc.webp?v=1765417464","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4170609a85665f2c6d3dbddb03e259afa99b7eb.webp?v=1765417464","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b620959df19014f5dcb21b7fe2fcdaf6821c20ea.webp?v=1765417465","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0db25af7c809c18b35e6687141d09aba382ff5a4.webp?v=1765417465","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4e732d5078280f5f4d601b9e98f3ab8f00c7005.webp?v=1765417466","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f8372160af5f620e14f2b0f2c18bdc0b60325b1.webp?v=1765417467","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/34d1e73bee80dc9c8b609d309b26f47751be30f4.webp?v=1765417467","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/360ca739ed4a7db7d1b72efc716975b438ba2f1b.webp?v=1765417468","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/006e2980206561998d3e8c690ac6541900d26722.webp?v=1765417468","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4628d92d39025434e732d80db35632ffa264113a_a3c16056-c0fb-4403-86ba-741476fee2d5.webp?v=1765419763","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4170609a85665f2c6d3dbddb03e259afa99b7eb_50507f81-f2b6-4d0b-a07d-1dbe67bc24d3.webp?v=1765419764","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/006e2980206561998d3e8c690ac6541900d26722_418998ad-4518-4ec0-89a9-cb4febc7531a.webp?v=1765419764","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b620959df19014f5dcb21b7fe2fcdaf6821c20ea_d0790a50-a299-4498-8d31-67369556e2cb.webp?v=1765419765","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/34d1e73bee80dc9c8b609d309b26f47751be30f4_af944e82-62cc-4db8-8f0d-6f162895aae7.webp?v=1765419765","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb8ad212d30404fd3d590f2ca89dcc73dabbec8a_af9e1b7a-c4f2-4a19-8a6b-f501fa74acbc.webp?v=1765419766","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f8372160af5f620e14f2b0f2c18bdc0b60325b1_397c61d0-864b-4735-961e-a47fb3f5711c.webp?v=1765419766","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a0d9327fa7db046f742a49b0b8d4b69ebc0b9ffc_772a7fc5-e73a-400d-a04a-2fde0a90e2e5.webp?v=1765419767","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0db25af7c809c18b35e6687141d09aba382ff5a4_e64cf53d-c51a-4801-85f5-2e787166af83.webp?v=1765419767","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/360ca739ed4a7db7d1b72efc716975b438ba2f1b_6f8490d4-9270-4c0f-93ff-3a3707de30e2.webp?v=1765419768","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4e732d5078280f5f4d601b9e98f3ab8f00c7005_8e61e3d7-ff9e-4a53-868e-d0e15712013c.webp?v=1765419768"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb8ad212d30404fd3d590f2ca89dcc73dabbec8a.webp?v=1765417463","options":["color"],"media":[{"alt":null,"id":26493199089763,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb8ad212d30404fd3d590f2ca89dcc73dabbec8a.webp?v=1765417463"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb8ad212d30404fd3d590f2ca89dcc73dabbec8a.webp?v=1765417463","width":2000},{"alt":null,"id":26493199319139,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4628d92d39025434e732d80db35632ffa264113a.webp?v=1765417463"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4628d92d39025434e732d80db35632ffa264113a.webp?v=1765417463","width":2000},{"alt":null,"id":26493199515747,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a0d9327fa7db046f742a49b0b8d4b69ebc0b9ffc.webp?v=1765417464"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a0d9327fa7db046f742a49b0b8d4b69ebc0b9ffc.webp?v=1765417464","width":2000},{"alt":null,"id":26493199810659,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4170609a85665f2c6d3dbddb03e259afa99b7eb.webp?v=1765417464"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4170609a85665f2c6d3dbddb03e259afa99b7eb.webp?v=1765417464","width":2000},{"alt":null,"id":26493199941731,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b620959df19014f5dcb21b7fe2fcdaf6821c20ea.webp?v=1765417465"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b620959df19014f5dcb21b7fe2fcdaf6821c20ea.webp?v=1765417465","width":2000},{"alt":null,"id":26493200040035,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0db25af7c809c18b35e6687141d09aba382ff5a4.webp?v=1765417465"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0db25af7c809c18b35e6687141d09aba382ff5a4.webp?v=1765417465","width":2000},{"alt":null,"id":26493200236643,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4e732d5078280f5f4d601b9e98f3ab8f00c7005.webp?v=1765417466"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4e732d5078280f5f4d601b9e98f3ab8f00c7005.webp?v=1765417466","width":2000},{"alt":null,"id":26493200498787,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f8372160af5f620e14f2b0f2c18bdc0b60325b1.webp?v=1765417467"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f8372160af5f620e14f2b0f2c18bdc0b60325b1.webp?v=1765417467","width":2000},{"alt":null,"id":26493200597091,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/34d1e73bee80dc9c8b609d309b26f47751be30f4.webp?v=1765417467"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/34d1e73bee80dc9c8b609d309b26f47751be30f4.webp?v=1765417467","width":2000},{"alt":null,"id":26493200728163,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/360ca739ed4a7db7d1b72efc716975b438ba2f1b.webp?v=1765417468"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/360ca739ed4a7db7d1b72efc716975b438ba2f1b.webp?v=1765417468","width":2000},{"alt":null,"id":26493200826467,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/006e2980206561998d3e8c690ac6541900d26722.webp?v=1765417468"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/006e2980206561998d3e8c690ac6541900d26722.webp?v=1765417468","width":2000},{"alt":null,"id":26494032347235,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4628d92d39025434e732d80db35632ffa264113a_a3c16056-c0fb-4403-86ba-741476fee2d5.webp?v=1765419763"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4628d92d39025434e732d80db35632ffa264113a_a3c16056-c0fb-4403-86ba-741476fee2d5.webp?v=1765419763","width":2000},{"alt":null,"id":26494032543843,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4170609a85665f2c6d3dbddb03e259afa99b7eb_50507f81-f2b6-4d0b-a07d-1dbe67bc24d3.webp?v=1765419764"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4170609a85665f2c6d3dbddb03e259afa99b7eb_50507f81-f2b6-4d0b-a07d-1dbe67bc24d3.webp?v=1765419764","width":2000},{"alt":null,"id":26494032740451,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/006e2980206561998d3e8c690ac6541900d26722_418998ad-4518-4ec0-89a9-cb4febc7531a.webp?v=1765419764"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/006e2980206561998d3e8c690ac6541900d26722_418998ad-4518-4ec0-89a9-cb4febc7531a.webp?v=1765419764","width":2000},{"alt":null,"id":26494032871523,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b620959df19014f5dcb21b7fe2fcdaf6821c20ea_d0790a50-a299-4498-8d31-67369556e2cb.webp?v=1765419765"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b620959df19014f5dcb21b7fe2fcdaf6821c20ea_d0790a50-a299-4498-8d31-67369556e2cb.webp?v=1765419765","width":2000},{"alt":null,"id":26494033002595,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/34d1e73bee80dc9c8b609d309b26f47751be30f4_af944e82-62cc-4db8-8f0d-6f162895aae7.webp?v=1765419765"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/34d1e73bee80dc9c8b609d309b26f47751be30f4_af944e82-62cc-4db8-8f0d-6f162895aae7.webp?v=1765419765","width":2000},{"alt":null,"id":26494033133667,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb8ad212d30404fd3d590f2ca89dcc73dabbec8a_af9e1b7a-c4f2-4a19-8a6b-f501fa74acbc.webp?v=1765419766"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eb8ad212d30404fd3d590f2ca89dcc73dabbec8a_af9e1b7a-c4f2-4a19-8a6b-f501fa74acbc.webp?v=1765419766","width":2000},{"alt":null,"id":26494033297507,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f8372160af5f620e14f2b0f2c18bdc0b60325b1_397c61d0-864b-4735-961e-a47fb3f5711c.webp?v=1765419766"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f8372160af5f620e14f2b0f2c18bdc0b60325b1_397c61d0-864b-4735-961e-a47fb3f5711c.webp?v=1765419766","width":2000},{"alt":null,"id":26494033461347,"position":19,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a0d9327fa7db046f742a49b0b8d4b69ebc0b9ffc_772a7fc5-e73a-400d-a04a-2fde0a90e2e5.webp?v=1765419767"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a0d9327fa7db046f742a49b0b8d4b69ebc0b9ffc_772a7fc5-e73a-400d-a04a-2fde0a90e2e5.webp?v=1765419767","width":2000},{"alt":null,"id":26494033592419,"position":20,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0db25af7c809c18b35e6687141d09aba382ff5a4_e64cf53d-c51a-4801-85f5-2e787166af83.webp?v=1765419767"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0db25af7c809c18b35e6687141d09aba382ff5a4_e64cf53d-c51a-4801-85f5-2e787166af83.webp?v=1765419767","width":2000},{"alt":null,"id":26494033821795,"position":21,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/360ca739ed4a7db7d1b72efc716975b438ba2f1b_6f8490d4-9270-4c0f-93ff-3a3707de30e2.webp?v=1765419768"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/360ca739ed4a7db7d1b72efc716975b438ba2f1b_6f8490d4-9270-4c0f-93ff-3a3707de30e2.webp?v=1765419768","width":2000},{"alt":null,"id":26494034116707,"position":22,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4e732d5078280f5f4d601b9e98f3ab8f00c7005_8e61e3d7-ff9e-4a53-868e-d0e15712013c.webp?v=1765419768"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4e732d5078280f5f4d601b9e98f3ab8f00c7005_8e61e3d7-ff9e-4a53-868e-d0e15712013c.webp?v=1765419768","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $bumper = null; $variants = [{"id":43882957799523,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-CJY02","requires_shipping":true,"taxable":true,"featured_image":{"id":34931658293347,"product_id":7937554284643,"position":13,"created_at":"2025-12-11T10:22:42+08:00","updated_at":"2025-12-11T10:22:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4170609a85665f2c6d3dbddb03e259afa99b7eb_50507f81-f2b6-4d0b-a07d-1dbe67bc24d3.webp?v=1765419764","variant_ids":[43882957799523]},"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-CJY02","featured_media":{"alt":null,"id":26494032543843,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4170609a85665f2c6d3dbddb03e259afa99b7eb_50507f81-f2b6-4d0b-a07d-1dbe67bc24d3.webp?v=1765419764"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43882957799523,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-CJY02","requires_shipping":true,"taxable":true,"featured_image":{"id":34931658293347,"product_id":7937554284643,"position":13,"created_at":"2025-12-11T10:22:42+08:00","updated_at":"2025-12-11T10:22:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4170609a85665f2c6d3dbddb03e259afa99b7eb_50507f81-f2b6-4d0b-a07d-1dbe67bc24d3.webp?v=1765419764","variant_ids":[43882957799523]},"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-CJY02","featured_media":{"alt":null,"id":26494032543843,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4170609a85665f2c6d3dbddb03e259afa99b7eb_50507f81-f2b6-4d0b-a07d-1dbe67bc24d3.webp?v=1765419764"}},"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: "停產" }