$product = {"id":7959973265507,"title":"iPhone 12 mini SolidSuit Knock Knock A2Z Wonderful World","handle":"iphone-12-mini-solidsuit-classic-en08","description":null,"published_at":"2026-02-09T11:21:35+08:00","created_at":"2026-02-06T17:31:57+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-knockknockatoz","device-iPhone 12 Mini","merge","reseller-knockknockatoz"],"price":83000,"price_min":83000,"price_max":83000,"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":43988856537187,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"SST01184O9-EN08","requires_shipping":true,"taxable":true,"featured_image":{"id":36200191983715,"product_id":7959973265507,"position":15,"created_at":"2026-07-07T18:04:12+08:00","updated_at":"2026-07-07T18:04:14+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b50b04b4d399ff7e833cb476b08a67dcbdb5caed_0acd7bd6-ab04-4b56-accc-4e8bd3ad635e.webp?v=1783418654","variant_ids":[43988856537187]},"available":true,"name":"iPhone 12 mini SolidSuit Knock Knock A2Z Wonderful World - Cobalt Blue","public_title":"Cobalt Blue","options":["Cobalt Blue"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST01184O9-EN08","featured_media":{"alt":null,"id":27704997445731,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b50b04b4d399ff7e833cb476b08a67dcbdb5caed_0acd7bd6-ab04-4b56-accc-4e8bd3ad635e.webp?v=1783418654"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43991379968099,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"SST011840B-EN08","requires_shipping":true,"taxable":true,"featured_image":{"id":36200191656035,"product_id":7959973265507,"position":14,"created_at":"2026-07-07T18:04:11+08:00","updated_at":"2026-07-07T18:04:13+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fffc1b6bff239d78096537986e4e0789b7c9b0a8_fcb2dae4-0460-461d-8b3a-cf2488d94e48.webp?v=1783418653","variant_ids":[43991379968099]},"available":true,"name":"iPhone 12 mini SolidSuit Knock Knock A2Z Wonderful World - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST011840B-EN08","featured_media":{"alt":null,"id":27704997118051,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fffc1b6bff239d78096537986e4e0789b7c9b0a8_fcb2dae4-0460-461d-8b3a-cf2488d94e48.webp?v=1783418653"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43991382392931,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"SST0118452-EN08","requires_shipping":true,"taxable":true,"featured_image":{"id":36200190148707,"product_id":7959973265507,"position":10,"created_at":"2026-07-07T18:04:08+08:00","updated_at":"2026-07-07T18:04:11+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2971096c80607cdb92443abbffd8079f0fb270e8_44f18ab6-ad20-4182-bff6-ae7300b20611.webp?v=1783418651","variant_ids":[43991382392931]},"available":true,"name":"iPhone 12 mini SolidSuit Knock Knock A2Z Wonderful World - Black","public_title":"Black","options":["Black"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST0118452-EN08","featured_media":{"alt":null,"id":27704995577955,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2971096c80607cdb92443abbffd8079f0fb270e8_44f18ab6-ad20-4182-bff6-ae7300b20611.webp?v=1783418651"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75bda827437fcbcf7c10e6242e9131ba0deaf3e0.webp?v=1770600719","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/61bd55d58e4bcea2d71b6eea4c7f84870d34abb9.webp?v=1770600720","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b50b04b4d399ff7e833cb476b08a67dcbdb5caed.webp?v=1770600720","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e4eb8c3cc09f2676f3e88c631eed9989c2c4aae3.webp?v=1770600721","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3a54cdfc5dcae3bf34613aa37cd11e320ab8caf.webp?v=1770600722","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/31d67d3d3b37faa52e0a9bce7911d9d08d0740cd.webp?v=1770600724","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/58400585c173cee6ecbff959ff56c1812794edd9.webp?v=1770600724","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fffc1b6bff239d78096537986e4e0789b7c9b0a8.webp?v=1770600724","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2971096c80607cdb92443abbffd8079f0fb270e8.webp?v=1770600724","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2971096c80607cdb92443abbffd8079f0fb270e8_44f18ab6-ad20-4182-bff6-ae7300b20611.webp?v=1783418651","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e4eb8c3cc09f2676f3e88c631eed9989c2c4aae3_f66954c8-02b1-496c-92f1-2f5042e62df4.webp?v=1783418651","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75bda827437fcbcf7c10e6242e9131ba0deaf3e0_953fca80-ea0d-4bbf-94ea-185c9d3b8607.webp?v=1783418652","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/31d67d3d3b37faa52e0a9bce7911d9d08d0740cd_8348379c-c3fa-4a5c-9473-ce492f583a17.webp?v=1783418652","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fffc1b6bff239d78096537986e4e0789b7c9b0a8_fcb2dae4-0460-461d-8b3a-cf2488d94e48.webp?v=1783418653","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b50b04b4d399ff7e833cb476b08a67dcbdb5caed_0acd7bd6-ab04-4b56-accc-4e8bd3ad635e.webp?v=1783418654"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75bda827437fcbcf7c10e6242e9131ba0deaf3e0.webp?v=1770600719","options":["color"],"media":[{"alt":null,"id":26765738475619,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75bda827437fcbcf7c10e6242e9131ba0deaf3e0.webp?v=1770600719"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75bda827437fcbcf7c10e6242e9131ba0deaf3e0.webp?v=1770600719","width":2000},{"alt":null,"id":26765738803299,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/61bd55d58e4bcea2d71b6eea4c7f84870d34abb9.webp?v=1770600720"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/61bd55d58e4bcea2d71b6eea4c7f84870d34abb9.webp?v=1770600720","width":2000},{"alt":null,"id":26765739163747,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b50b04b4d399ff7e833cb476b08a67dcbdb5caed.webp?v=1770600720"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b50b04b4d399ff7e833cb476b08a67dcbdb5caed.webp?v=1770600720","width":2000},{"alt":null,"id":26765739655267,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e4eb8c3cc09f2676f3e88c631eed9989c2c4aae3.webp?v=1770600721"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e4eb8c3cc09f2676f3e88c631eed9989c2c4aae3.webp?v=1770600721","width":2000},{"alt":null,"id":26765740114019,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3a54cdfc5dcae3bf34613aa37cd11e320ab8caf.webp?v=1770600722"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b3a54cdfc5dcae3bf34613aa37cd11e320ab8caf.webp?v=1770600722","width":2000},{"alt":null,"id":26765740802147,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/31d67d3d3b37faa52e0a9bce7911d9d08d0740cd.webp?v=1770600724"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/31d67d3d3b37faa52e0a9bce7911d9d08d0740cd.webp?v=1770600724","width":2000},{"alt":null,"id":26765741424739,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/58400585c173cee6ecbff959ff56c1812794edd9.webp?v=1770600724"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/58400585c173cee6ecbff959ff56c1812794edd9.webp?v=1770600724","width":2000},{"alt":null,"id":26765741916259,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fffc1b6bff239d78096537986e4e0789b7c9b0a8.webp?v=1770600724"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fffc1b6bff239d78096537986e4e0789b7c9b0a8.webp?v=1770600724","width":2000},{"alt":null,"id":26765742407779,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2971096c80607cdb92443abbffd8079f0fb270e8.webp?v=1770600724"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2971096c80607cdb92443abbffd8079f0fb270e8.webp?v=1770600724","width":2000},{"alt":null,"id":27704995577955,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2971096c80607cdb92443abbffd8079f0fb270e8_44f18ab6-ad20-4182-bff6-ae7300b20611.webp?v=1783418651"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2971096c80607cdb92443abbffd8079f0fb270e8_44f18ab6-ad20-4182-bff6-ae7300b20611.webp?v=1783418651","width":2000},{"alt":null,"id":27704996036707,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e4eb8c3cc09f2676f3e88c631eed9989c2c4aae3_f66954c8-02b1-496c-92f1-2f5042e62df4.webp?v=1783418651"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e4eb8c3cc09f2676f3e88c631eed9989c2c4aae3_f66954c8-02b1-496c-92f1-2f5042e62df4.webp?v=1783418651","width":2000},{"alt":null,"id":27704996364387,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75bda827437fcbcf7c10e6242e9131ba0deaf3e0_953fca80-ea0d-4bbf-94ea-185c9d3b8607.webp?v=1783418652"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75bda827437fcbcf7c10e6242e9131ba0deaf3e0_953fca80-ea0d-4bbf-94ea-185c9d3b8607.webp?v=1783418652","width":2000},{"alt":null,"id":27704996790371,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/31d67d3d3b37faa52e0a9bce7911d9d08d0740cd_8348379c-c3fa-4a5c-9473-ce492f583a17.webp?v=1783418652"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/31d67d3d3b37faa52e0a9bce7911d9d08d0740cd_8348379c-c3fa-4a5c-9473-ce492f583a17.webp?v=1783418652","width":2000},{"alt":null,"id":27704997118051,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fffc1b6bff239d78096537986e4e0789b7c9b0a8_fcb2dae4-0460-461d-8b3a-cf2488d94e48.webp?v=1783418653"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fffc1b6bff239d78096537986e4e0789b7c9b0a8_fcb2dae4-0460-461d-8b3a-cf2488d94e48.webp?v=1783418653","width":2000},{"alt":null,"id":27704997445731,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b50b04b4d399ff7e833cb476b08a67dcbdb5caed_0acd7bd6-ab04-4b56-accc-4e8bd3ad635e.webp?v=1783418654"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b50b04b4d399ff7e833cb476b08a67dcbdb5caed_0acd7bd6-ab04-4b56-accc-4e8bd3ad635e.webp?v=1783418654","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43988856537187,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"SST01184O9-EN08","requires_shipping":true,"taxable":true,"featured_image":{"id":36200191983715,"product_id":7959973265507,"position":15,"created_at":"2026-07-07T18:04:12+08:00","updated_at":"2026-07-07T18:04:14+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b50b04b4d399ff7e833cb476b08a67dcbdb5caed_0acd7bd6-ab04-4b56-accc-4e8bd3ad635e.webp?v=1783418654","variant_ids":[43988856537187]},"available":true,"name":"iPhone 12 mini SolidSuit Knock Knock A2Z Wonderful World - Cobalt Blue","public_title":"Cobalt Blue","options":["Cobalt Blue"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST01184O9-EN08","featured_media":{"alt":null,"id":27704997445731,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b50b04b4d399ff7e833cb476b08a67dcbdb5caed_0acd7bd6-ab04-4b56-accc-4e8bd3ad635e.webp?v=1783418654"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43991379968099,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"SST011840B-EN08","requires_shipping":true,"taxable":true,"featured_image":{"id":36200191656035,"product_id":7959973265507,"position":14,"created_at":"2026-07-07T18:04:11+08:00","updated_at":"2026-07-07T18:04:13+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fffc1b6bff239d78096537986e4e0789b7c9b0a8_fcb2dae4-0460-461d-8b3a-cf2488d94e48.webp?v=1783418653","variant_ids":[43991379968099]},"available":true,"name":"iPhone 12 mini SolidSuit Knock Knock A2Z Wonderful World - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST011840B-EN08","featured_media":{"alt":null,"id":27704997118051,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fffc1b6bff239d78096537986e4e0789b7c9b0a8_fcb2dae4-0460-461d-8b3a-cf2488d94e48.webp?v=1783418653"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43991382392931,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"SST0118452-EN08","requires_shipping":true,"taxable":true,"featured_image":{"id":36200190148707,"product_id":7959973265507,"position":10,"created_at":"2026-07-07T18:04:08+08:00","updated_at":"2026-07-07T18:04:11+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2971096c80607cdb92443abbffd8079f0fb270e8_44f18ab6-ad20-4182-bff6-ae7300b20611.webp?v=1783418651","variant_ids":[43991382392931]},"available":true,"name":"iPhone 12 mini SolidSuit Knock Knock A2Z Wonderful World - Black","public_title":"Black","options":["Black"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST0118452-EN08","featured_media":{"alt":null,"id":27704995577955,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2971096c80607cdb92443abbffd8079f0fb270e8_44f18ab6-ad20-4182-bff6-ae7300b20611.webp?v=1783418651"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43988856537187,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"SST01184O9-EN08","requires_shipping":true,"taxable":true,"featured_image":{"id":36200191983715,"product_id":7959973265507,"position":15,"created_at":"2026-07-07T18:04:12+08:00","updated_at":"2026-07-07T18:04:14+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b50b04b4d399ff7e833cb476b08a67dcbdb5caed_0acd7bd6-ab04-4b56-accc-4e8bd3ad635e.webp?v=1783418654","variant_ids":[43988856537187]},"available":true,"name":"iPhone 12 mini SolidSuit Knock Knock A2Z Wonderful World - Cobalt Blue","public_title":"Cobalt Blue","options":["Cobalt Blue"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST01184O9-EN08","featured_media":{"alt":null,"id":27704997445731,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b50b04b4d399ff7e833cb476b08a67dcbdb5caed_0acd7bd6-ab04-4b56-accc-4e8bd3ad635e.webp?v=1783418654"}},"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: "停產" }