$product = {"id":7770051182691,"title":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Cat Dive - 跳水貓咪","handle":"iphone-14-pro-mod-nx-magsafe-printable-xf51","description":null,"published_at":"2025-04-16T12:40:53+08:00","created_at":"2025-04-15T23:32:35+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"設計師MOD NX MagSafe專區I Love Doodle","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-ilovedoodle","device-iPhone 14 Pro","merge","reseller-ilovedoodle"],"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":43305204023395,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF51","requires_shipping":true,"taxable":true,"featured_image":{"id":34197851144291,"product_id":7770051182691,"position":10,"created_at":"2025-07-16T15:23:32+08:00","updated_at":"2025-07-16T15:23:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ff1243914f4ba01cacaca1cc22475c92513639e_b2cdf0c4-2bf7-4eb2-8369-4240132ecb5f.webp?v=1752650614","variant_ids":[43305204023395]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Cat Dive - 跳水貓咪 - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0126224-XF51","featured_media":{"alt":null,"id":25830135824483,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ff1243914f4ba01cacaca1cc22475c92513639e_b2cdf0c4-2bf7-4eb2-8369-4240132ecb5f.webp?v=1752650614"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43305208610915,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0126204-XF51","requires_shipping":true,"taxable":true,"featured_image":{"id":34197846917219,"product_id":7770051182691,"position":3,"created_at":"2025-07-16T15:23:28+08:00","updated_at":"2025-07-16T15:23:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13a1a5549c5a53fc628da0537fd850a23a2327df_7e779d03-3421-42fd-8f88-7d90a1f15371.webp?v=1752650609","variant_ids":[43305208610915]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Cat Dive - 跳水貓咪 - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0126204-XF51","featured_media":{"alt":null,"id":25830133727331,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13a1a5549c5a53fc628da0537fd850a23a2327df_7e779d03-3421-42fd-8f88-7d90a1f15371.webp?v=1752650609"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43305208774755,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01262J5-XF51","requires_shipping":true,"taxable":true,"featured_image":{"id":34197847474275,"product_id":7770051182691,"position":4,"created_at":"2025-07-16T15:23:28+08:00","updated_at":"2025-07-16T15:23:30+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8107f64e96465a1ec4ee25187dfbe37ba3cef471_4b07a48a-e371-455f-b3ef-8fae1f8fbefc.webp?v=1752650610","variant_ids":[43305208774755]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Cat Dive - 跳水貓咪 - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01262J5-XF51","featured_media":{"alt":null,"id":25830134087779,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8107f64e96465a1ec4ee25187dfbe37ba3cef471_4b07a48a-e371-455f-b3ef-8fae1f8fbefc.webp?v=1752650610"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/98a2034819b58a978802d544f126b63fb74fc333_25a93ed9-05b5-4638-b6f7-e9402d9adf57.webp?v=1744731161","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa478d0398bbe43d49ecf516efc9e76dc3cdfa04_fd36dd77-64c8-4a7a-a6ac-d20a11c78398.webp?v=1752650609","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13a1a5549c5a53fc628da0537fd850a23a2327df_7e779d03-3421-42fd-8f88-7d90a1f15371.webp?v=1752650609","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8107f64e96465a1ec4ee25187dfbe37ba3cef471_4b07a48a-e371-455f-b3ef-8fae1f8fbefc.webp?v=1752650610","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2df94d04eb94ceda51b6ede7ca90ff4bc3d6fab6_850c39ba-ec20-45f8-ae32-f80d507b5263.webp?v=1752650611","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2009c8099e92424db9bf3adf35611842b1ddbf4d_b1254f6b-aef3-4a15-8e7a-abeb69340748.webp?v=1752650611","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04d844563f62d05bea604555a14ade9f0224ec81_4cef0f99-3eb6-48ac-b92f-11e3434b372a.webp?v=1752650612","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3357a8e7ce9d138a13c56e55ecf0256b10010b6_5fd34d61-f285-415b-bfd8-69deb2650c7b.webp?v=1752650613","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/428ca0a9140e3b5705541ec7f7f72a2f6bdffc64_fa685059-4da2-481e-9193-1f51630e64c7.webp?v=1752650613","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ff1243914f4ba01cacaca1cc22475c92513639e_b2cdf0c4-2bf7-4eb2-8369-4240132ecb5f.webp?v=1752650614","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/27a8572ab4e963e28aea2cdf0edb407b12e1b11e_2ad24a67-cbbe-4d26-93b5-0aebf5d970c5.webp?v=1752650615","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/880d8844c954680a489a04764eb0a383cbf11195_783ba13f-324b-4b5c-912b-ea5070b71437.webp?v=1752650615","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a37e4727cfc72ee8f9dfacf9890d66e146debe1d_957b0155-61f5-4ef8-bc5c-78c4fd29f476.webp?v=1752650616"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/98a2034819b58a978802d544f126b63fb74fc333_25a93ed9-05b5-4638-b6f7-e9402d9adf57.webp?v=1744731161","options":["color"],"media":[{"alt":null,"id":25496803967075,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/98a2034819b58a978802d544f126b63fb74fc333_25a93ed9-05b5-4638-b6f7-e9402d9adf57.webp?v=1744731161"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/98a2034819b58a978802d544f126b63fb74fc333_25a93ed9-05b5-4638-b6f7-e9402d9adf57.webp?v=1744731161","width":2000},{"alt":null,"id":25830133465187,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa478d0398bbe43d49ecf516efc9e76dc3cdfa04_fd36dd77-64c8-4a7a-a6ac-d20a11c78398.webp?v=1752650609"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fa478d0398bbe43d49ecf516efc9e76dc3cdfa04_fd36dd77-64c8-4a7a-a6ac-d20a11c78398.webp?v=1752650609","width":2000},{"alt":null,"id":25830133727331,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13a1a5549c5a53fc628da0537fd850a23a2327df_7e779d03-3421-42fd-8f88-7d90a1f15371.webp?v=1752650609"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13a1a5549c5a53fc628da0537fd850a23a2327df_7e779d03-3421-42fd-8f88-7d90a1f15371.webp?v=1752650609","width":2000},{"alt":null,"id":25830134087779,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8107f64e96465a1ec4ee25187dfbe37ba3cef471_4b07a48a-e371-455f-b3ef-8fae1f8fbefc.webp?v=1752650610"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8107f64e96465a1ec4ee25187dfbe37ba3cef471_4b07a48a-e371-455f-b3ef-8fae1f8fbefc.webp?v=1752650610","width":2000},{"alt":null,"id":25830134415459,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2df94d04eb94ceda51b6ede7ca90ff4bc3d6fab6_850c39ba-ec20-45f8-ae32-f80d507b5263.webp?v=1752650611"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2df94d04eb94ceda51b6ede7ca90ff4bc3d6fab6_850c39ba-ec20-45f8-ae32-f80d507b5263.webp?v=1752650611","width":2000},{"alt":null,"id":25830134743139,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2009c8099e92424db9bf3adf35611842b1ddbf4d_b1254f6b-aef3-4a15-8e7a-abeb69340748.webp?v=1752650611"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2009c8099e92424db9bf3adf35611842b1ddbf4d_b1254f6b-aef3-4a15-8e7a-abeb69340748.webp?v=1752650611","width":2000},{"alt":null,"id":25830135169123,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04d844563f62d05bea604555a14ade9f0224ec81_4cef0f99-3eb6-48ac-b92f-11e3434b372a.webp?v=1752650612"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04d844563f62d05bea604555a14ade9f0224ec81_4cef0f99-3eb6-48ac-b92f-11e3434b372a.webp?v=1752650612","width":2000},{"alt":null,"id":25830135464035,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3357a8e7ce9d138a13c56e55ecf0256b10010b6_5fd34d61-f285-415b-bfd8-69deb2650c7b.webp?v=1752650613"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f3357a8e7ce9d138a13c56e55ecf0256b10010b6_5fd34d61-f285-415b-bfd8-69deb2650c7b.webp?v=1752650613","width":2000},{"alt":null,"id":25830135627875,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/428ca0a9140e3b5705541ec7f7f72a2f6bdffc64_fa685059-4da2-481e-9193-1f51630e64c7.webp?v=1752650613"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/428ca0a9140e3b5705541ec7f7f72a2f6bdffc64_fa685059-4da2-481e-9193-1f51630e64c7.webp?v=1752650613","width":2000},{"alt":null,"id":25830135824483,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ff1243914f4ba01cacaca1cc22475c92513639e_b2cdf0c4-2bf7-4eb2-8369-4240132ecb5f.webp?v=1752650614"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ff1243914f4ba01cacaca1cc22475c92513639e_b2cdf0c4-2bf7-4eb2-8369-4240132ecb5f.webp?v=1752650614","width":2000},{"alt":null,"id":25830136184931,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/27a8572ab4e963e28aea2cdf0edb407b12e1b11e_2ad24a67-cbbe-4d26-93b5-0aebf5d970c5.webp?v=1752650615"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/27a8572ab4e963e28aea2cdf0edb407b12e1b11e_2ad24a67-cbbe-4d26-93b5-0aebf5d970c5.webp?v=1752650615","width":2000},{"alt":null,"id":25830136447075,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/880d8844c954680a489a04764eb0a383cbf11195_783ba13f-324b-4b5c-912b-ea5070b71437.webp?v=1752650615"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/880d8844c954680a489a04764eb0a383cbf11195_783ba13f-324b-4b5c-912b-ea5070b71437.webp?v=1752650615","width":2000},{"alt":null,"id":25830136840291,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a37e4727cfc72ee8f9dfacf9890d66e146debe1d_957b0155-61f5-4ef8-bc5c-78c4fd29f476.webp?v=1752650616"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a37e4727cfc72ee8f9dfacf9890d66e146debe1d_957b0155-61f5-4ef8-bc5c-78c4fd29f476.webp?v=1752650616","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43305204023395,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF51","requires_shipping":true,"taxable":true,"featured_image":{"id":34197851144291,"product_id":7770051182691,"position":10,"created_at":"2025-07-16T15:23:32+08:00","updated_at":"2025-07-16T15:23:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ff1243914f4ba01cacaca1cc22475c92513639e_b2cdf0c4-2bf7-4eb2-8369-4240132ecb5f.webp?v=1752650614","variant_ids":[43305204023395]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Cat Dive - 跳水貓咪 - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0126224-XF51","featured_media":{"alt":null,"id":25830135824483,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ff1243914f4ba01cacaca1cc22475c92513639e_b2cdf0c4-2bf7-4eb2-8369-4240132ecb5f.webp?v=1752650614"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43305208610915,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0126204-XF51","requires_shipping":true,"taxable":true,"featured_image":{"id":34197846917219,"product_id":7770051182691,"position":3,"created_at":"2025-07-16T15:23:28+08:00","updated_at":"2025-07-16T15:23:29+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13a1a5549c5a53fc628da0537fd850a23a2327df_7e779d03-3421-42fd-8f88-7d90a1f15371.webp?v=1752650609","variant_ids":[43305208610915]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Cat Dive - 跳水貓咪 - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0126204-XF51","featured_media":{"alt":null,"id":25830133727331,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13a1a5549c5a53fc628da0537fd850a23a2327df_7e779d03-3421-42fd-8f88-7d90a1f15371.webp?v=1752650609"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43305208774755,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01262J5-XF51","requires_shipping":true,"taxable":true,"featured_image":{"id":34197847474275,"product_id":7770051182691,"position":4,"created_at":"2025-07-16T15:23:28+08:00","updated_at":"2025-07-16T15:23:30+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8107f64e96465a1ec4ee25187dfbe37ba3cef471_4b07a48a-e371-455f-b3ef-8fae1f8fbefc.webp?v=1752650610","variant_ids":[43305208774755]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Cat Dive - 跳水貓咪 - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01262J5-XF51","featured_media":{"alt":null,"id":25830134087779,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8107f64e96465a1ec4ee25187dfbe37ba3cef471_4b07a48a-e371-455f-b3ef-8fae1f8fbefc.webp?v=1752650610"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43305204023395,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF51","requires_shipping":true,"taxable":true,"featured_image":{"id":34197851144291,"product_id":7770051182691,"position":10,"created_at":"2025-07-16T15:23:32+08:00","updated_at":"2025-07-16T15:23:34+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ff1243914f4ba01cacaca1cc22475c92513639e_b2cdf0c4-2bf7-4eb2-8369-4240132ecb5f.webp?v=1752650614","variant_ids":[43305204023395]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Cat Dive - 跳水貓咪 - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0126224-XF51","featured_media":{"alt":null,"id":25830135824483,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ff1243914f4ba01cacaca1cc22475c92513639e_b2cdf0c4-2bf7-4eb2-8369-4240132ecb5f.webp?v=1752650614"}},"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: "停產" }