$product = {"id":7155894255715,"title":"iPhone 15 Pro Clear 1G 生日8","handle":"iphone-15-pro-jellytint-iv02","description":null,"published_at":"2024-02-02T09:58:58+08:00","created_at":"2024-01-23T17:07:57+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"設計師JellyTint專區-1G","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-1chun","device-iPhone 15 Pro","merge","reseller-1chun"],"price":128000,"price_min":128000,"price_max":128000,"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":41197171572835,"title":"Ash Black","option1":"Ash Black","option2":null,"option3":null,"sku":"CCN012970G-IV02","requires_shipping":true,"taxable":true,"featured_image":{"id":36322971320419,"product_id":7155894255715,"position":12,"created_at":"2026-07-20T18:28:27+08:00","updated_at":"2026-07-20T18:28:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9690f901726a1b07740d480e03ce0934b52e826a_f171d1c5-1e91-4387-85f1-81fca395450b.webp?v=1784543309","variant_ids":[41197171572835]},"available":true,"name":"iPhone 15 Pro Clear 1G 生日8 - Ash Black","public_title":"Ash Black","options":["Ash Black"],"price":128000,"weight":1080,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"CCN012970G-IV02","featured_media":{"alt":null,"id":27826879135843,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9690f901726a1b07740d480e03ce0934b52e826a_f171d1c5-1e91-4387-85f1-81fca395450b.webp?v=1784543309"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":41197171605603,"title":"Moody Green","option1":"Moody Green","option2":null,"option3":null,"sku":"CCN012970H-IV02","requires_shipping":true,"taxable":true,"featured_image":{"id":36322972729443,"product_id":7155894255715,"position":13,"created_at":"2026-07-20T18:28:30+08:00","updated_at":"2026-07-20T18:28:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d1a0c6ca9697b8a9145cdca8ea10deb16259947_18cbfdf1-ac5b-4c8e-bc1e-12d2a5731359.webp?v=1784543312","variant_ids":[41197171605603]},"available":true,"name":"iPhone 15 Pro Clear 1G 生日8 - Moody Green","public_title":"Moody Green","options":["Moody Green"],"price":128000,"weight":1080,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"CCN012970H-IV02","featured_media":{"alt":null,"id":27826880544867,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d1a0c6ca9697b8a9145cdca8ea10deb16259947_18cbfdf1-ac5b-4c8e-bc1e-12d2a5731359.webp?v=1784543312"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":41197171638371,"title":"Cyber Blue","option1":"Cyber Blue","option2":null,"option3":null,"sku":"CCN012970I-IV02","requires_shipping":true,"taxable":true,"featured_image":{"id":36322973581411,"product_id":7155894255715,"position":14,"created_at":"2026-07-20T18:28:34+08:00","updated_at":"2026-07-20T18:28:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aaed61583ffdbf3f865862d12d6bb6f80cccc4bf_ec6b58cd-09c5-4e4b-ab1a-251fd03ae7e9.webp?v=1784543316","variant_ids":[41197171638371]},"available":true,"name":"iPhone 15 Pro Clear 1G 生日8 - Cyber Blue","public_title":"Cyber Blue","options":["Cyber Blue"],"price":128000,"weight":1080,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"CCN012970I-IV02","featured_media":{"alt":null,"id":27826881364067,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aaed61583ffdbf3f865862d12d6bb6f80cccc4bf_ec6b58cd-09c5-4e4b-ab1a-251fd03ae7e9.webp?v=1784543316"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/745457652e326ba5df831c7787aedf12b7f21090_42d0b869-165f-484b-a869-820c0f894bcf.webp?v=1706000882","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2822a109a9d66bfb609fdf87ca249e7b598ad847_1e08b226-7c95-4152-be16-432870d2ab2a.webp?v=1706000884","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6943908f38cd44ef8cec87c99d3dcd249dcf18e2_20fd7a42-52ee-4fb6-9023-08a558e80c7b.webp?v=1706000887","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fd295dfdef9031e8f209654bc4c49b9cb6aae152_c50879e1-2e51-4772-8695-643668f915df.webp?v=1706000889","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5d0c74e419aa3d4b6d76882c93c674b69346cb15_3c8ab2d0-8b5f-430e-b092-33ec867b23d1.webp?v=1706000891","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9a5cf70873a04755e3a93ac1eb25b27558558013_8a46edfa-985d-4880-8015-52eb4cb0c89a.webp?v=1706000894","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e6c9d470021c9ebc3fc828095047a3cf69ea03b_2f660cf0-2541-4e87-9727-9b9ca15c6fbe.webp?v=1706000896","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c3f7271c7385c6f643ef73b0e3dbde76ed19214a_d4201902-2b88-46e7-a04d-2a621c24360b.webp?v=1706253807","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aaed61583ffdbf3f865862d12d6bb6f80cccc4bf.webp?v=1782882967","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d1a0c6ca9697b8a9145cdca8ea10deb16259947.webp?v=1782882967","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9690f901726a1b07740d480e03ce0934b52e826a.webp?v=1782882968","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9690f901726a1b07740d480e03ce0934b52e826a_f171d1c5-1e91-4387-85f1-81fca395450b.webp?v=1784543309","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d1a0c6ca9697b8a9145cdca8ea10deb16259947_18cbfdf1-ac5b-4c8e-bc1e-12d2a5731359.webp?v=1784543312","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aaed61583ffdbf3f865862d12d6bb6f80cccc4bf_ec6b58cd-09c5-4e4b-ab1a-251fd03ae7e9.webp?v=1784543316"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/745457652e326ba5df831c7787aedf12b7f21090_42d0b869-165f-484b-a869-820c0f894bcf.webp?v=1706000882","options":["color"],"media":[{"alt":null,"id":23202001616995,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/745457652e326ba5df831c7787aedf12b7f21090_42d0b869-165f-484b-a869-820c0f894bcf.webp?v=1706000882"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/745457652e326ba5df831c7787aedf12b7f21090_42d0b869-165f-484b-a869-820c0f894bcf.webp?v=1706000882","width":2000},{"alt":null,"id":23202002272355,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2822a109a9d66bfb609fdf87ca249e7b598ad847_1e08b226-7c95-4152-be16-432870d2ab2a.webp?v=1706000884"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2822a109a9d66bfb609fdf87ca249e7b598ad847_1e08b226-7c95-4152-be16-432870d2ab2a.webp?v=1706000884","width":2000},{"alt":null,"id":23202002993251,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6943908f38cd44ef8cec87c99d3dcd249dcf18e2_20fd7a42-52ee-4fb6-9023-08a558e80c7b.webp?v=1706000887"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6943908f38cd44ef8cec87c99d3dcd249dcf18e2_20fd7a42-52ee-4fb6-9023-08a558e80c7b.webp?v=1706000887","width":2000},{"alt":null,"id":23202003550307,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fd295dfdef9031e8f209654bc4c49b9cb6aae152_c50879e1-2e51-4772-8695-643668f915df.webp?v=1706000889"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fd295dfdef9031e8f209654bc4c49b9cb6aae152_c50879e1-2e51-4772-8695-643668f915df.webp?v=1706000889","width":2000},{"alt":null,"id":23202004140131,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5d0c74e419aa3d4b6d76882c93c674b69346cb15_3c8ab2d0-8b5f-430e-b092-33ec867b23d1.webp?v=1706000891"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5d0c74e419aa3d4b6d76882c93c674b69346cb15_3c8ab2d0-8b5f-430e-b092-33ec867b23d1.webp?v=1706000891","width":2000},{"alt":null,"id":23202004893795,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9a5cf70873a04755e3a93ac1eb25b27558558013_8a46edfa-985d-4880-8015-52eb4cb0c89a.webp?v=1706000894"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9a5cf70873a04755e3a93ac1eb25b27558558013_8a46edfa-985d-4880-8015-52eb4cb0c89a.webp?v=1706000894","width":2000},{"alt":null,"id":23202005549155,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e6c9d470021c9ebc3fc828095047a3cf69ea03b_2f660cf0-2541-4e87-9727-9b9ca15c6fbe.webp?v=1706000896"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0e6c9d470021c9ebc3fc828095047a3cf69ea03b_2f660cf0-2541-4e87-9727-9b9ca15c6fbe.webp?v=1706000896","width":2000},{"alt":null,"id":23217566679139,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c3f7271c7385c6f643ef73b0e3dbde76ed19214a_d4201902-2b88-46e7-a04d-2a621c24360b.webp?v=1706253807"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c3f7271c7385c6f643ef73b0e3dbde76ed19214a_d4201902-2b88-46e7-a04d-2a621c24360b.webp?v=1706253807","width":2000},{"alt":null,"id":27647718391907,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aaed61583ffdbf3f865862d12d6bb6f80cccc4bf.webp?v=1782882967"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aaed61583ffdbf3f865862d12d6bb6f80cccc4bf.webp?v=1782882967","width":2000},{"alt":null,"id":27647718981731,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d1a0c6ca9697b8a9145cdca8ea10deb16259947.webp?v=1782882967"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d1a0c6ca9697b8a9145cdca8ea10deb16259947.webp?v=1782882967","width":2000},{"alt":null,"id":27647720161379,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9690f901726a1b07740d480e03ce0934b52e826a.webp?v=1782882968"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9690f901726a1b07740d480e03ce0934b52e826a.webp?v=1782882968","width":2000},{"alt":null,"id":27826879135843,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9690f901726a1b07740d480e03ce0934b52e826a_f171d1c5-1e91-4387-85f1-81fca395450b.webp?v=1784543309"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9690f901726a1b07740d480e03ce0934b52e826a_f171d1c5-1e91-4387-85f1-81fca395450b.webp?v=1784543309","width":2000},{"alt":null,"id":27826880544867,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d1a0c6ca9697b8a9145cdca8ea10deb16259947_18cbfdf1-ac5b-4c8e-bc1e-12d2a5731359.webp?v=1784543312"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d1a0c6ca9697b8a9145cdca8ea10deb16259947_18cbfdf1-ac5b-4c8e-bc1e-12d2a5731359.webp?v=1784543312","width":2000},{"alt":null,"id":27826881364067,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aaed61583ffdbf3f865862d12d6bb6f80cccc4bf_ec6b58cd-09c5-4e4b-ab1a-251fd03ae7e9.webp?v=1784543316"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aaed61583ffdbf3f865862d12d6bb6f80cccc4bf_ec6b58cd-09c5-4e4b-ab1a-251fd03ae7e9.webp?v=1784543316","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":41197171572835,"title":"Ash Black","option1":"Ash Black","option2":null,"option3":null,"sku":"CCN012970G-IV02","requires_shipping":true,"taxable":true,"featured_image":{"id":36322971320419,"product_id":7155894255715,"position":12,"created_at":"2026-07-20T18:28:27+08:00","updated_at":"2026-07-20T18:28:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9690f901726a1b07740d480e03ce0934b52e826a_f171d1c5-1e91-4387-85f1-81fca395450b.webp?v=1784543309","variant_ids":[41197171572835]},"available":true,"name":"iPhone 15 Pro Clear 1G 生日8 - Ash Black","public_title":"Ash Black","options":["Ash Black"],"price":128000,"weight":1080,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"CCN012970G-IV02","featured_media":{"alt":null,"id":27826879135843,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9690f901726a1b07740d480e03ce0934b52e826a_f171d1c5-1e91-4387-85f1-81fca395450b.webp?v=1784543309"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":41197171605603,"title":"Moody Green","option1":"Moody Green","option2":null,"option3":null,"sku":"CCN012970H-IV02","requires_shipping":true,"taxable":true,"featured_image":{"id":36322972729443,"product_id":7155894255715,"position":13,"created_at":"2026-07-20T18:28:30+08:00","updated_at":"2026-07-20T18:28:32+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d1a0c6ca9697b8a9145cdca8ea10deb16259947_18cbfdf1-ac5b-4c8e-bc1e-12d2a5731359.webp?v=1784543312","variant_ids":[41197171605603]},"available":true,"name":"iPhone 15 Pro Clear 1G 生日8 - Moody Green","public_title":"Moody Green","options":["Moody Green"],"price":128000,"weight":1080,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"CCN012970H-IV02","featured_media":{"alt":null,"id":27826880544867,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7d1a0c6ca9697b8a9145cdca8ea10deb16259947_18cbfdf1-ac5b-4c8e-bc1e-12d2a5731359.webp?v=1784543312"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":41197171638371,"title":"Cyber Blue","option1":"Cyber Blue","option2":null,"option3":null,"sku":"CCN012970I-IV02","requires_shipping":true,"taxable":true,"featured_image":{"id":36322973581411,"product_id":7155894255715,"position":14,"created_at":"2026-07-20T18:28:34+08:00","updated_at":"2026-07-20T18:28:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aaed61583ffdbf3f865862d12d6bb6f80cccc4bf_ec6b58cd-09c5-4e4b-ab1a-251fd03ae7e9.webp?v=1784543316","variant_ids":[41197171638371]},"available":true,"name":"iPhone 15 Pro Clear 1G 生日8 - Cyber Blue","public_title":"Cyber Blue","options":["Cyber Blue"],"price":128000,"weight":1080,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"CCN012970I-IV02","featured_media":{"alt":null,"id":27826881364067,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aaed61583ffdbf3f865862d12d6bb6f80cccc4bf_ec6b58cd-09c5-4e4b-ab1a-251fd03ae7e9.webp?v=1784543316"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":41197171572835,"title":"Ash Black","option1":"Ash Black","option2":null,"option3":null,"sku":"CCN012970G-IV02","requires_shipping":true,"taxable":true,"featured_image":{"id":36322971320419,"product_id":7155894255715,"position":12,"created_at":"2026-07-20T18:28:27+08:00","updated_at":"2026-07-20T18:28:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9690f901726a1b07740d480e03ce0934b52e826a_f171d1c5-1e91-4387-85f1-81fca395450b.webp?v=1784543309","variant_ids":[41197171572835]},"available":true,"name":"iPhone 15 Pro Clear 1G 生日8 - Ash Black","public_title":"Ash Black","options":["Ash Black"],"price":128000,"weight":1080,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"CCN012970G-IV02","featured_media":{"alt":null,"id":27826879135843,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9690f901726a1b07740d480e03ce0934b52e826a_f171d1c5-1e91-4387-85f1-81fca395450b.webp?v=1784543309"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}; $device_handle = null; $brand_handle = null; $type = ""; var sellingStatus // 只有設計款(SKU 含 '-')才需要合圖 if ($isMerge && $defaultVariant.sku.includes('-')) { $(document).ready(function() { var productImg = $product.images[0]; var bumperImg = window.getProductImageUrl($defaultVariant.sku.split('-')[0]); var layers = ($type === 'mod-nx-backplate' || $type === 'mod-backplate') ? [productImg, bumperImg] : [bumperImg, productImg]; window.mergeProductImages(layers).then(function (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: "停產" }