$product = {"id":7769796739171,"title":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Mindful Cat - Love Yourself","handle":"iphone-14-pro-mod-nx-magsafe-printable-xf47","description":null,"published_at":"2025-04-16T14:21:27+08:00","created_at":"2025-04-15T20:39:26+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":43303988920419,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF47","requires_shipping":true,"taxable":true,"featured_image":{"id":34197824733283,"product_id":7769796739171,"position":12,"created_at":"2025-07-16T15:23:08+08:00","updated_at":"2025-07-16T15:23:10+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b7b3afd9b0dec2c1934ea04f6e96fba941a38601_2e214167-3eb1-4850-a33b-7fae76cba3a4.webp?v=1752650590","variant_ids":[43303988920419]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Mindful Cat - Love Yourself - 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-XF47","featured_media":{"alt":null,"id":25830122061923,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b7b3afd9b0dec2c1934ea04f6e96fba941a38601_2e214167-3eb1-4850-a33b-7fae76cba3a4.webp?v=1752650590"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303996096611,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0126204-XF47","requires_shipping":true,"taxable":true,"featured_image":{"id":34197818146915,"product_id":7769796739171,"position":4,"created_at":"2025-07-16T15:23:01+08:00","updated_at":"2025-07-16T15:23:03+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3003633abbba137fa6c1d46a50ebcf64f30272a_36780e04-b305-4a60-bf9e-2bcf35c9640d.webp?v=1752650583","variant_ids":[43303996096611]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Mindful Cat - Love Yourself - 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-XF47","featured_media":{"alt":null,"id":25830118457443,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3003633abbba137fa6c1d46a50ebcf64f30272a_36780e04-b305-4a60-bf9e-2bcf35c9640d.webp?v=1752650583"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303996260451,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01262J5-XF47","requires_shipping":true,"taxable":true,"featured_image":{"id":34197816344675,"product_id":7769796739171,"position":2,"created_at":"2025-07-16T15:23:00+08:00","updated_at":"2025-07-16T15:23:02+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/74892df73b2d62df544340350eef0ea989b53c39_12704c7a-04ff-45e2-96eb-1b1ccbda747c.webp?v=1752650582","variant_ids":[43303996260451]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Mindful Cat - Love Yourself - 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-XF47","featured_media":{"alt":null,"id":25830117671011,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/74892df73b2d62df544340350eef0ea989b53c39_12704c7a-04ff-45e2-96eb-1b1ccbda747c.webp?v=1752650582"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/185ee535f699f4ed5d67d01ee895c94fd6603f6b_1bb13073-f135-42af-b5b9-3b349cf9b8a7.webp?v=1744720773","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/74892df73b2d62df544340350eef0ea989b53c39_12704c7a-04ff-45e2-96eb-1b1ccbda747c.webp?v=1752650582","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6648d1db627d3156baac16d8a24a5e5111cc877f_115599a0-9f63-4f2b-b0a5-6c9bb32fd96e.webp?v=1752650583","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3003633abbba137fa6c1d46a50ebcf64f30272a_36780e04-b305-4a60-bf9e-2bcf35c9640d.webp?v=1752650583","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/92fe923ddc675dad6a7534304b6a34e3220c0ba3_5a4ea487-0e92-40a8-be6f-e3f3e229718a.webp?v=1752650584","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/91ce2c664b99c2c52a2a88980d7dc09d2e43d721_fa479634-1999-4453-ae8c-3b808d74340b.webp?v=1752650585","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a139b18261ac82d7f4a154ed9f3e81f95d16c141_5ed98381-f80c-4319-b3da-648f7a685596.webp?v=1752650586","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8bd28945ab36233926c58bf2261d1bcef453783_8c9167b5-5a9d-46b8-a1a0-92b3cab4189d.webp?v=1752650586","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2ca106abccc82e48d0ccc9586dd901fd01a507ae_fe156e5e-47f6-44f0-b944-aeefc96f9199.webp?v=1752650587","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1af138824b4aee308eee42e73d6e740e97c1ed74_0c80842a-4851-490b-9b4a-7118d93c578a.webp?v=1752650588","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef6b4491979a514bcfdba9211ab35e5baab9a726_bd42a41c-d166-49ae-b5d5-e3303ed0114a.webp?v=1752650589","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b7b3afd9b0dec2c1934ea04f6e96fba941a38601_2e214167-3eb1-4850-a33b-7fae76cba3a4.webp?v=1752650590","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a466bcb3743506e5904c22f8bf7f74c6670b73f2_87fbdab8-53f4-40d3-b2da-cc0fd38ea450.webp?v=1752650590"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/185ee535f699f4ed5d67d01ee895c94fd6603f6b_1bb13073-f135-42af-b5b9-3b349cf9b8a7.webp?v=1744720773","options":["color"],"media":[{"alt":null,"id":25496288723043,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/185ee535f699f4ed5d67d01ee895c94fd6603f6b_1bb13073-f135-42af-b5b9-3b349cf9b8a7.webp?v=1744720773"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/185ee535f699f4ed5d67d01ee895c94fd6603f6b_1bb13073-f135-42af-b5b9-3b349cf9b8a7.webp?v=1744720773","width":2000},{"alt":null,"id":25830117671011,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/74892df73b2d62df544340350eef0ea989b53c39_12704c7a-04ff-45e2-96eb-1b1ccbda747c.webp?v=1752650582"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/74892df73b2d62df544340350eef0ea989b53c39_12704c7a-04ff-45e2-96eb-1b1ccbda747c.webp?v=1752650582","width":2000},{"alt":null,"id":25830118064227,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6648d1db627d3156baac16d8a24a5e5111cc877f_115599a0-9f63-4f2b-b0a5-6c9bb32fd96e.webp?v=1752650583"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6648d1db627d3156baac16d8a24a5e5111cc877f_115599a0-9f63-4f2b-b0a5-6c9bb32fd96e.webp?v=1752650583","width":2000},{"alt":null,"id":25830118457443,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3003633abbba137fa6c1d46a50ebcf64f30272a_36780e04-b305-4a60-bf9e-2bcf35c9640d.webp?v=1752650583"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3003633abbba137fa6c1d46a50ebcf64f30272a_36780e04-b305-4a60-bf9e-2bcf35c9640d.webp?v=1752650583","width":2000},{"alt":null,"id":25830118817891,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/92fe923ddc675dad6a7534304b6a34e3220c0ba3_5a4ea487-0e92-40a8-be6f-e3f3e229718a.webp?v=1752650584"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/92fe923ddc675dad6a7534304b6a34e3220c0ba3_5a4ea487-0e92-40a8-be6f-e3f3e229718a.webp?v=1752650584","width":2000},{"alt":null,"id":25830119538787,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/91ce2c664b99c2c52a2a88980d7dc09d2e43d721_fa479634-1999-4453-ae8c-3b808d74340b.webp?v=1752650585"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/91ce2c664b99c2c52a2a88980d7dc09d2e43d721_fa479634-1999-4453-ae8c-3b808d74340b.webp?v=1752650585","width":2000},{"alt":null,"id":25830120063075,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a139b18261ac82d7f4a154ed9f3e81f95d16c141_5ed98381-f80c-4319-b3da-648f7a685596.webp?v=1752650586"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a139b18261ac82d7f4a154ed9f3e81f95d16c141_5ed98381-f80c-4319-b3da-648f7a685596.webp?v=1752650586","width":2000},{"alt":null,"id":25830120226915,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8bd28945ab36233926c58bf2261d1bcef453783_8c9167b5-5a9d-46b8-a1a0-92b3cab4189d.webp?v=1752650586"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8bd28945ab36233926c58bf2261d1bcef453783_8c9167b5-5a9d-46b8-a1a0-92b3cab4189d.webp?v=1752650586","width":2000},{"alt":null,"id":25830120652899,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2ca106abccc82e48d0ccc9586dd901fd01a507ae_fe156e5e-47f6-44f0-b944-aeefc96f9199.webp?v=1752650587"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2ca106abccc82e48d0ccc9586dd901fd01a507ae_fe156e5e-47f6-44f0-b944-aeefc96f9199.webp?v=1752650587","width":2000},{"alt":null,"id":25830121111651,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1af138824b4aee308eee42e73d6e740e97c1ed74_0c80842a-4851-490b-9b4a-7118d93c578a.webp?v=1752650588"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1af138824b4aee308eee42e73d6e740e97c1ed74_0c80842a-4851-490b-9b4a-7118d93c578a.webp?v=1752650588","width":2000},{"alt":null,"id":25830121472099,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef6b4491979a514bcfdba9211ab35e5baab9a726_bd42a41c-d166-49ae-b5d5-e3303ed0114a.webp?v=1752650589"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ef6b4491979a514bcfdba9211ab35e5baab9a726_bd42a41c-d166-49ae-b5d5-e3303ed0114a.webp?v=1752650589","width":2000},{"alt":null,"id":25830122061923,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b7b3afd9b0dec2c1934ea04f6e96fba941a38601_2e214167-3eb1-4850-a33b-7fae76cba3a4.webp?v=1752650590"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b7b3afd9b0dec2c1934ea04f6e96fba941a38601_2e214167-3eb1-4850-a33b-7fae76cba3a4.webp?v=1752650590","width":2000},{"alt":null,"id":25830122389603,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a466bcb3743506e5904c22f8bf7f74c6670b73f2_87fbdab8-53f4-40d3-b2da-cc0fd38ea450.webp?v=1752650590"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a466bcb3743506e5904c22f8bf7f74c6670b73f2_87fbdab8-53f4-40d3-b2da-cc0fd38ea450.webp?v=1752650590","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43303988920419,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF47","requires_shipping":true,"taxable":true,"featured_image":{"id":34197824733283,"product_id":7769796739171,"position":12,"created_at":"2025-07-16T15:23:08+08:00","updated_at":"2025-07-16T15:23:10+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b7b3afd9b0dec2c1934ea04f6e96fba941a38601_2e214167-3eb1-4850-a33b-7fae76cba3a4.webp?v=1752650590","variant_ids":[43303988920419]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Mindful Cat - Love Yourself - 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-XF47","featured_media":{"alt":null,"id":25830122061923,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b7b3afd9b0dec2c1934ea04f6e96fba941a38601_2e214167-3eb1-4850-a33b-7fae76cba3a4.webp?v=1752650590"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303996096611,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0126204-XF47","requires_shipping":true,"taxable":true,"featured_image":{"id":34197818146915,"product_id":7769796739171,"position":4,"created_at":"2025-07-16T15:23:01+08:00","updated_at":"2025-07-16T15:23:03+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3003633abbba137fa6c1d46a50ebcf64f30272a_36780e04-b305-4a60-bf9e-2bcf35c9640d.webp?v=1752650583","variant_ids":[43303996096611]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Mindful Cat - Love Yourself - 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-XF47","featured_media":{"alt":null,"id":25830118457443,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3003633abbba137fa6c1d46a50ebcf64f30272a_36780e04-b305-4a60-bf9e-2bcf35c9640d.webp?v=1752650583"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43303996260451,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01262J5-XF47","requires_shipping":true,"taxable":true,"featured_image":{"id":34197816344675,"product_id":7769796739171,"position":2,"created_at":"2025-07-16T15:23:00+08:00","updated_at":"2025-07-16T15:23:02+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/74892df73b2d62df544340350eef0ea989b53c39_12704c7a-04ff-45e2-96eb-1b1ccbda747c.webp?v=1752650582","variant_ids":[43303996260451]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Mindful Cat - Love Yourself - 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-XF47","featured_media":{"alt":null,"id":25830117671011,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/74892df73b2d62df544340350eef0ea989b53c39_12704c7a-04ff-45e2-96eb-1b1ccbda747c.webp?v=1752650582"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43303988920419,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0126224-XF47","requires_shipping":true,"taxable":true,"featured_image":{"id":34197824733283,"product_id":7769796739171,"position":12,"created_at":"2025-07-16T15:23:08+08:00","updated_at":"2025-07-16T15:23:10+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b7b3afd9b0dec2c1934ea04f6e96fba941a38601_2e214167-3eb1-4850-a33b-7fae76cba3a4.webp?v=1752650590","variant_ids":[43303988920419]},"available":true,"name":"iPhone 14 Pro Mod NX (MagSafe 兼容) ilovedoodle Mindful Cat - Love Yourself - 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-XF47","featured_media":{"alt":null,"id":25830122061923,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b7b3afd9b0dec2c1934ea04f6e96fba941a38601_2e214167-3eb1-4850-a33b-7fae76cba3a4.webp?v=1752650590"}},"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: "停產" }