$product = {"id":7937557168227,"title":"iPhone 12 mini Mod NX (MagSafe 兼容) Jin Young Choi 幸運小精靈","handle":"iphone-12-mini-mod-nx-magsafe-cjy09","description":null,"published_at":"2025-12-12T09:50:16+08:00","created_at":"2025-12-11T09:44:59+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":110000,"price_min":110000,"price_max":110000,"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":43882968842339,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118424-CJY09","requires_shipping":true,"taxable":true,"featured_image":{"id":34931839107171,"product_id":7937557168227,"position":22,"created_at":"2025-12-11T10:28:34+08:00","updated_at":"2025-12-11T10:28:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/df66eb69742b30ee3b4a2fb86d596b38c52d73db_95ce0c80-5f64-484b-87da-49a23465f63a.webp?v=1765420116","variant_ids":[43882968842339]},"available":true,"name":"iPhone 12 mini Mod NX (MagSafe 兼容) Jin Young Choi 幸運小精靈 - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118424-CJY09","featured_media":{"alt":null,"id":26494213357667,"position":22,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/df66eb69742b30ee3b4a2fb86d596b38c52d73db_95ce0c80-5f64-484b-87da-49a23465f63a.webp?v=1765420116"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/53844c5a8416bc2aa4bc5feb5e93337c27ec91bb.webp?v=1765417506","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ff4fb615ced14e2d4c5080e52e1c67aa4a4a975.webp?v=1765417507","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/df66eb69742b30ee3b4a2fb86d596b38c52d73db.webp?v=1765417509","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/19b58310acede8bc027dd6bdf3dce1b029052ebe.webp?v=1765417510","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d5dcf15562ef4146e3b769d53e195a94506f3865.webp?v=1765417510","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/127a3ade64add395757c4c53d8eaff8834ed4596.webp?v=1765417511","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa6e292f88a0e87221222da8b98ed8f6201ab1c2.webp?v=1765417511","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f37996caf9ccec74ddd6dcd372c05e17833356c9.webp?v=1765417512","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e14a9dad83c6641bd2a7d30532a18cadf35180f.webp?v=1765417512","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/271233ed6f6a1f4e65ff47a267203b919383b126.webp?v=1765417513","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9a98955d8ab87d41bba67957ddaa4fe2b27569c.webp?v=1765417514","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa6e292f88a0e87221222da8b98ed8f6201ab1c2_076f6b7f-3c8c-4a62-aa36-e1b1f86b7d29.webp?v=1765420110","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ff4fb615ced14e2d4c5080e52e1c67aa4a4a975_8a6cac5b-e746-4df9-8e8e-2c7cb0624aeb.webp?v=1765420110","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f37996caf9ccec74ddd6dcd372c05e17833356c9_f1e4a33c-5310-407c-9b43-1b6a6fb7de21.webp?v=1765420111","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/271233ed6f6a1f4e65ff47a267203b919383b126_ea38903f-6c84-4071-966e-d42a12c76403.webp?v=1765420111","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/53844c5a8416bc2aa4bc5feb5e93337c27ec91bb_2af23747-b978-4eed-9c41-926e5fa613c0.webp?v=1765420112","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/127a3ade64add395757c4c53d8eaff8834ed4596_c3f3e8db-1d9a-4739-8aa5-904fc62bd8bd.webp?v=1765420112","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9a98955d8ab87d41bba67957ddaa4fe2b27569c_54318e4c-5651-4fee-be9c-3ec5849374d6.webp?v=1765420113","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/19b58310acede8bc027dd6bdf3dce1b029052ebe_05abaed4-0634-4549-b070-7ac3386a1722.webp?v=1765420115","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e14a9dad83c6641bd2a7d30532a18cadf35180f_f5e66bad-45c8-4402-b162-993fbfe69cc6.webp?v=1765420115","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d5dcf15562ef4146e3b769d53e195a94506f3865_b45d459f-ab2e-4635-8766-d4d7060cf823.webp?v=1765420116","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/df66eb69742b30ee3b4a2fb86d596b38c52d73db_95ce0c80-5f64-484b-87da-49a23465f63a.webp?v=1765420116"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/53844c5a8416bc2aa4bc5feb5e93337c27ec91bb.webp?v=1765417506","options":["color"],"media":[{"alt":null,"id":26493211082851,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/53844c5a8416bc2aa4bc5feb5e93337c27ec91bb.webp?v=1765417506"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/53844c5a8416bc2aa4bc5feb5e93337c27ec91bb.webp?v=1765417506","width":2000},{"alt":null,"id":26493211181155,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ff4fb615ced14e2d4c5080e52e1c67aa4a4a975.webp?v=1765417507"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ff4fb615ced14e2d4c5080e52e1c67aa4a4a975.webp?v=1765417507","width":2000},{"alt":null,"id":26493211443299,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/df66eb69742b30ee3b4a2fb86d596b38c52d73db.webp?v=1765417509"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/df66eb69742b30ee3b4a2fb86d596b38c52d73db.webp?v=1765417509","width":2000},{"alt":null,"id":26493211836515,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/19b58310acede8bc027dd6bdf3dce1b029052ebe.webp?v=1765417510"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/19b58310acede8bc027dd6bdf3dce1b029052ebe.webp?v=1765417510","width":2000},{"alt":null,"id":26493212164195,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d5dcf15562ef4146e3b769d53e195a94506f3865.webp?v=1765417510"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d5dcf15562ef4146e3b769d53e195a94506f3865.webp?v=1765417510","width":2000},{"alt":null,"id":26493212426339,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/127a3ade64add395757c4c53d8eaff8834ed4596.webp?v=1765417511"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/127a3ade64add395757c4c53d8eaff8834ed4596.webp?v=1765417511","width":2000},{"alt":null,"id":26493212622947,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa6e292f88a0e87221222da8b98ed8f6201ab1c2.webp?v=1765417511"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa6e292f88a0e87221222da8b98ed8f6201ab1c2.webp?v=1765417511","width":2000},{"alt":null,"id":26493212786787,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f37996caf9ccec74ddd6dcd372c05e17833356c9.webp?v=1765417512"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f37996caf9ccec74ddd6dcd372c05e17833356c9.webp?v=1765417512","width":2000},{"alt":null,"id":26493212917859,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e14a9dad83c6641bd2a7d30532a18cadf35180f.webp?v=1765417512"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e14a9dad83c6641bd2a7d30532a18cadf35180f.webp?v=1765417512","width":2000},{"alt":null,"id":26493213016163,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/271233ed6f6a1f4e65ff47a267203b919383b126.webp?v=1765417513"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/271233ed6f6a1f4e65ff47a267203b919383b126.webp?v=1765417513","width":2000},{"alt":null,"id":26493213147235,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9a98955d8ab87d41bba67957ddaa4fe2b27569c.webp?v=1765417514"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9a98955d8ab87d41bba67957ddaa4fe2b27569c.webp?v=1765417514","width":2000},{"alt":null,"id":26494210277475,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa6e292f88a0e87221222da8b98ed8f6201ab1c2_076f6b7f-3c8c-4a62-aa36-e1b1f86b7d29.webp?v=1765420110"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa6e292f88a0e87221222da8b98ed8f6201ab1c2_076f6b7f-3c8c-4a62-aa36-e1b1f86b7d29.webp?v=1765420110","width":2000},{"alt":null,"id":26494210703459,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ff4fb615ced14e2d4c5080e52e1c67aa4a4a975_8a6cac5b-e746-4df9-8e8e-2c7cb0624aeb.webp?v=1765420110"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6ff4fb615ced14e2d4c5080e52e1c67aa4a4a975_8a6cac5b-e746-4df9-8e8e-2c7cb0624aeb.webp?v=1765420110","width":2000},{"alt":null,"id":26494210932835,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f37996caf9ccec74ddd6dcd372c05e17833356c9_f1e4a33c-5310-407c-9b43-1b6a6fb7de21.webp?v=1765420111"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f37996caf9ccec74ddd6dcd372c05e17833356c9_f1e4a33c-5310-407c-9b43-1b6a6fb7de21.webp?v=1765420111","width":2000},{"alt":null,"id":26494211194979,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/271233ed6f6a1f4e65ff47a267203b919383b126_ea38903f-6c84-4071-966e-d42a12c76403.webp?v=1765420111"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/271233ed6f6a1f4e65ff47a267203b919383b126_ea38903f-6c84-4071-966e-d42a12c76403.webp?v=1765420111","width":2000},{"alt":null,"id":26494211424355,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/53844c5a8416bc2aa4bc5feb5e93337c27ec91bb_2af23747-b978-4eed-9c41-926e5fa613c0.webp?v=1765420112"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/53844c5a8416bc2aa4bc5feb5e93337c27ec91bb_2af23747-b978-4eed-9c41-926e5fa613c0.webp?v=1765420112","width":2000},{"alt":null,"id":26494211883107,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/127a3ade64add395757c4c53d8eaff8834ed4596_c3f3e8db-1d9a-4739-8aa5-904fc62bd8bd.webp?v=1765420112"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/127a3ade64add395757c4c53d8eaff8834ed4596_c3f3e8db-1d9a-4739-8aa5-904fc62bd8bd.webp?v=1765420112","width":2000},{"alt":null,"id":26494212145251,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9a98955d8ab87d41bba67957ddaa4fe2b27569c_54318e4c-5651-4fee-be9c-3ec5849374d6.webp?v=1765420113"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d9a98955d8ab87d41bba67957ddaa4fe2b27569c_54318e4c-5651-4fee-be9c-3ec5849374d6.webp?v=1765420113","width":2000},{"alt":null,"id":26494212735075,"position":19,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/19b58310acede8bc027dd6bdf3dce1b029052ebe_05abaed4-0634-4549-b070-7ac3386a1722.webp?v=1765420115"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/19b58310acede8bc027dd6bdf3dce1b029052ebe_05abaed4-0634-4549-b070-7ac3386a1722.webp?v=1765420115","width":2000},{"alt":null,"id":26494212964451,"position":20,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e14a9dad83c6641bd2a7d30532a18cadf35180f_f5e66bad-45c8-4402-b162-993fbfe69cc6.webp?v=1765420115"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e14a9dad83c6641bd2a7d30532a18cadf35180f_f5e66bad-45c8-4402-b162-993fbfe69cc6.webp?v=1765420115","width":2000},{"alt":null,"id":26494213193827,"position":21,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d5dcf15562ef4146e3b769d53e195a94506f3865_b45d459f-ab2e-4635-8766-d4d7060cf823.webp?v=1765420116"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d5dcf15562ef4146e3b769d53e195a94506f3865_b45d459f-ab2e-4635-8766-d4d7060cf823.webp?v=1765420116","width":2000},{"alt":null,"id":26494213357667,"position":22,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/df66eb69742b30ee3b4a2fb86d596b38c52d73db_95ce0c80-5f64-484b-87da-49a23465f63a.webp?v=1765420116"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/df66eb69742b30ee3b4a2fb86d596b38c52d73db_95ce0c80-5f64-484b-87da-49a23465f63a.webp?v=1765420116","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $bumper = null; $variants = [{"id":43882968842339,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118424-CJY09","requires_shipping":true,"taxable":true,"featured_image":{"id":34931839107171,"product_id":7937557168227,"position":22,"created_at":"2025-12-11T10:28:34+08:00","updated_at":"2025-12-11T10:28:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/df66eb69742b30ee3b4a2fb86d596b38c52d73db_95ce0c80-5f64-484b-87da-49a23465f63a.webp?v=1765420116","variant_ids":[43882968842339]},"available":true,"name":"iPhone 12 mini Mod NX (MagSafe 兼容) Jin Young Choi 幸運小精靈 - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118424-CJY09","featured_media":{"alt":null,"id":26494213357667,"position":22,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/df66eb69742b30ee3b4a2fb86d596b38c52d73db_95ce0c80-5f64-484b-87da-49a23465f63a.webp?v=1765420116"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43882968842339,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118424-CJY09","requires_shipping":true,"taxable":true,"featured_image":{"id":34931839107171,"product_id":7937557168227,"position":22,"created_at":"2025-12-11T10:28:34+08:00","updated_at":"2025-12-11T10:28:36+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/df66eb69742b30ee3b4a2fb86d596b38c52d73db_95ce0c80-5f64-484b-87da-49a23465f63a.webp?v=1765420116","variant_ids":[43882968842339]},"available":true,"name":"iPhone 12 mini Mod NX (MagSafe 兼容) Jin Young Choi 幸運小精靈 - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118424-CJY09","featured_media":{"alt":null,"id":26494213357667,"position":22,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/df66eb69742b30ee3b4a2fb86d596b38c52d73db_95ce0c80-5f64-484b-87da-49a23465f63a.webp?v=1765420116"}},"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: "停產" }