$product = {"id":7920194453603,"title":"iPhone 12 mini Mod NX Incrediville 怪奇事物所 所長的星際迷航","handle":"iphone-12-mini-mod-nx-hd71","description":null,"published_at":"2025-11-13T09:56:22+08:00","created_at":"2025-11-10T10:08:51+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-incrediville","device-iPhone 12 Mini","merge","reseller-incrediville"],"price":90000,"price_min":90000,"price_max":90000,"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":43827895599203,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-HD71","requires_shipping":true,"taxable":true,"featured_image":{"id":34785986412643,"product_id":7920194453603,"position":15,"created_at":"2025-11-11T09:37:15+08:00","updated_at":"2025-11-11T09:37:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f8365e25fd006f91ed3c71a09313bd8d3baf6eb8_e7013682-e397-410b-a394-fa9fdad4726e.webp?v=1762825037","variant_ids":[43827895599203]},"available":true,"name":"iPhone 12 mini Mod NX Incrediville 怪奇事物所 所長的星際迷航 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118424-HD71","featured_media":{"alt":null,"id":26351443542115,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f8365e25fd006f91ed3c71a09313bd8d3baf6eb8_e7013682-e397-410b-a394-fa9fdad4726e.webp?v=1762825037"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9018e4166174948be8dd0fb618b47a714b16a6ff.webp?v=1762740538","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e982a84b77f84504ca5d0d410ca825afb02a1b85.webp?v=1762740539","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/50ac341d1a918fd2ad0d7cdfc6144d589fa0ef7e.webp?v=1762740540","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd173822dd20458ce7f93f506b41d66b156f48b8.webp?v=1762740541","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75f15e0f8a75e085cfee3019dffb0bfe9a4a3959.webp?v=1762740542","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf49f83e1b64e60435f8a51ed0f3a908f67c56aa.webp?v=1762740543","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f6811a8cdd3e01a3cbf8e568785b19d58cd751fd.webp?v=1762740544","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ad73f4c065d90205ec588acb3dc45221db6dfa1.webp?v=1762740544","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0aeb5a201460ed1a239c9afdf66b18439daa0baf.webp?v=1762740545","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f8365e25fd006f91ed3c71a09313bd8d3baf6eb8.webp?v=1762740545","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bcbd3edc6bebdb0aabd72ad171dbee928c65e03b.webp?v=1762740546","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd173822dd20458ce7f93f506b41d66b156f48b8_03c3cece-de6c-4803-87c4-8bca4fbd22fe.webp?v=1762825035","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f6811a8cdd3e01a3cbf8e568785b19d58cd751fd_f764fc82-9952-450e-bae1-f1442464bdb5.webp?v=1762825036","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bcbd3edc6bebdb0aabd72ad171dbee928c65e03b_c19c66d3-6984-4c90-9761-ab7e327be987.webp?v=1762825036","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f8365e25fd006f91ed3c71a09313bd8d3baf6eb8_e7013682-e397-410b-a394-fa9fdad4726e.webp?v=1762825037","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9018e4166174948be8dd0fb618b47a714b16a6ff_a204ac92-4d55-4abe-b26c-0afe8ac83860.webp?v=1762825038","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ad73f4c065d90205ec588acb3dc45221db6dfa1_ee627558-4a6b-47bf-ac77-2e3a53b26591.webp?v=1762825039","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/50ac341d1a918fd2ad0d7cdfc6144d589fa0ef7e_e2a6a1a7-f4f4-43e9-b720-68b7e22d3e08.webp?v=1762825039","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0aeb5a201460ed1a239c9afdf66b18439daa0baf_75056de2-ab2b-4f36-9fe6-059c4397102c.webp?v=1762825040","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf49f83e1b64e60435f8a51ed0f3a908f67c56aa_5eb93fd2-d61b-4b39-943a-1aff7d29ccf6.webp?v=1762825041","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e982a84b77f84504ca5d0d410ca825afb02a1b85_4b10bfcb-2515-40e0-b0f3-db0410d8198e.webp?v=1762825042","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75f15e0f8a75e085cfee3019dffb0bfe9a4a3959_63d6b9ee-74a8-48f9-a104-94ce77e24aa3.webp?v=1762825043"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9018e4166174948be8dd0fb618b47a714b16a6ff.webp?v=1762740538","options":["color"],"media":[{"alt":null,"id":26346398318691,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9018e4166174948be8dd0fb618b47a714b16a6ff.webp?v=1762740538"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9018e4166174948be8dd0fb618b47a714b16a6ff.webp?v=1762740538","width":2000},{"alt":null,"id":26346398515299,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e982a84b77f84504ca5d0d410ca825afb02a1b85.webp?v=1762740539"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e982a84b77f84504ca5d0d410ca825afb02a1b85.webp?v=1762740539","width":2000},{"alt":null,"id":26346398679139,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/50ac341d1a918fd2ad0d7cdfc6144d589fa0ef7e.webp?v=1762740540"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/50ac341d1a918fd2ad0d7cdfc6144d589fa0ef7e.webp?v=1762740540","width":2000},{"alt":null,"id":26346398810211,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd173822dd20458ce7f93f506b41d66b156f48b8.webp?v=1762740541"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd173822dd20458ce7f93f506b41d66b156f48b8.webp?v=1762740541","width":2000},{"alt":null,"id":26346399039587,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75f15e0f8a75e085cfee3019dffb0bfe9a4a3959.webp?v=1762740542"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75f15e0f8a75e085cfee3019dffb0bfe9a4a3959.webp?v=1762740542","width":2000},{"alt":null,"id":26346399203427,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf49f83e1b64e60435f8a51ed0f3a908f67c56aa.webp?v=1762740543"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf49f83e1b64e60435f8a51ed0f3a908f67c56aa.webp?v=1762740543","width":2000},{"alt":null,"id":26346399432803,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f6811a8cdd3e01a3cbf8e568785b19d58cd751fd.webp?v=1762740544"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f6811a8cdd3e01a3cbf8e568785b19d58cd751fd.webp?v=1762740544","width":2000},{"alt":null,"id":26346399596643,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ad73f4c065d90205ec588acb3dc45221db6dfa1.webp?v=1762740544"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ad73f4c065d90205ec588acb3dc45221db6dfa1.webp?v=1762740544","width":2000},{"alt":null,"id":26346399924323,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0aeb5a201460ed1a239c9afdf66b18439daa0baf.webp?v=1762740545"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0aeb5a201460ed1a239c9afdf66b18439daa0baf.webp?v=1762740545","width":2000},{"alt":null,"id":26346400153699,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f8365e25fd006f91ed3c71a09313bd8d3baf6eb8.webp?v=1762740545"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f8365e25fd006f91ed3c71a09313bd8d3baf6eb8.webp?v=1762740545","width":2000},{"alt":null,"id":26346400252003,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bcbd3edc6bebdb0aabd72ad171dbee928c65e03b.webp?v=1762740546"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bcbd3edc6bebdb0aabd72ad171dbee928c65e03b.webp?v=1762740546","width":2000},{"alt":null,"id":26351442919523,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd173822dd20458ce7f93f506b41d66b156f48b8_03c3cece-de6c-4803-87c4-8bca4fbd22fe.webp?v=1762825035"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd173822dd20458ce7f93f506b41d66b156f48b8_03c3cece-de6c-4803-87c4-8bca4fbd22fe.webp?v=1762825035","width":2000},{"alt":null,"id":26351443148899,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f6811a8cdd3e01a3cbf8e568785b19d58cd751fd_f764fc82-9952-450e-bae1-f1442464bdb5.webp?v=1762825036"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f6811a8cdd3e01a3cbf8e568785b19d58cd751fd_f764fc82-9952-450e-bae1-f1442464bdb5.webp?v=1762825036","width":2000},{"alt":null,"id":26351443345507,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bcbd3edc6bebdb0aabd72ad171dbee928c65e03b_c19c66d3-6984-4c90-9761-ab7e327be987.webp?v=1762825036"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bcbd3edc6bebdb0aabd72ad171dbee928c65e03b_c19c66d3-6984-4c90-9761-ab7e327be987.webp?v=1762825036","width":2000},{"alt":null,"id":26351443542115,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f8365e25fd006f91ed3c71a09313bd8d3baf6eb8_e7013682-e397-410b-a394-fa9fdad4726e.webp?v=1762825037"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f8365e25fd006f91ed3c71a09313bd8d3baf6eb8_e7013682-e397-410b-a394-fa9fdad4726e.webp?v=1762825037","width":2000},{"alt":null,"id":26351443738723,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9018e4166174948be8dd0fb618b47a714b16a6ff_a204ac92-4d55-4abe-b26c-0afe8ac83860.webp?v=1762825038"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9018e4166174948be8dd0fb618b47a714b16a6ff_a204ac92-4d55-4abe-b26c-0afe8ac83860.webp?v=1762825038","width":2000},{"alt":null,"id":26351443968099,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ad73f4c065d90205ec588acb3dc45221db6dfa1_ee627558-4a6b-47bf-ac77-2e3a53b26591.webp?v=1762825039"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ad73f4c065d90205ec588acb3dc45221db6dfa1_ee627558-4a6b-47bf-ac77-2e3a53b26591.webp?v=1762825039","width":2000},{"alt":null,"id":26351444164707,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/50ac341d1a918fd2ad0d7cdfc6144d589fa0ef7e_e2a6a1a7-f4f4-43e9-b720-68b7e22d3e08.webp?v=1762825039"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/50ac341d1a918fd2ad0d7cdfc6144d589fa0ef7e_e2a6a1a7-f4f4-43e9-b720-68b7e22d3e08.webp?v=1762825039","width":2000},{"alt":null,"id":26351444656227,"position":19,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0aeb5a201460ed1a239c9afdf66b18439daa0baf_75056de2-ab2b-4f36-9fe6-059c4397102c.webp?v=1762825040"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0aeb5a201460ed1a239c9afdf66b18439daa0baf_75056de2-ab2b-4f36-9fe6-059c4397102c.webp?v=1762825040","width":2000},{"alt":null,"id":26351444918371,"position":20,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf49f83e1b64e60435f8a51ed0f3a908f67c56aa_5eb93fd2-d61b-4b39-943a-1aff7d29ccf6.webp?v=1762825041"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cf49f83e1b64e60435f8a51ed0f3a908f67c56aa_5eb93fd2-d61b-4b39-943a-1aff7d29ccf6.webp?v=1762825041","width":2000},{"alt":null,"id":26351445147747,"position":21,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e982a84b77f84504ca5d0d410ca825afb02a1b85_4b10bfcb-2515-40e0-b0f3-db0410d8198e.webp?v=1762825042"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e982a84b77f84504ca5d0d410ca825afb02a1b85_4b10bfcb-2515-40e0-b0f3-db0410d8198e.webp?v=1762825042","width":2000},{"alt":null,"id":26351445377123,"position":22,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75f15e0f8a75e085cfee3019dffb0bfe9a4a3959_63d6b9ee-74a8-48f9-a104-94ce77e24aa3.webp?v=1762825043"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75f15e0f8a75e085cfee3019dffb0bfe9a4a3959_63d6b9ee-74a8-48f9-a104-94ce77e24aa3.webp?v=1762825043","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43827895599203,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-HD71","requires_shipping":true,"taxable":true,"featured_image":{"id":34785986412643,"product_id":7920194453603,"position":15,"created_at":"2025-11-11T09:37:15+08:00","updated_at":"2025-11-11T09:37:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f8365e25fd006f91ed3c71a09313bd8d3baf6eb8_e7013682-e397-410b-a394-fa9fdad4726e.webp?v=1762825037","variant_ids":[43827895599203]},"available":true,"name":"iPhone 12 mini Mod NX Incrediville 怪奇事物所 所長的星際迷航 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118424-HD71","featured_media":{"alt":null,"id":26351443542115,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f8365e25fd006f91ed3c71a09313bd8d3baf6eb8_e7013682-e397-410b-a394-fa9fdad4726e.webp?v=1762825037"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43827895599203,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-HD71","requires_shipping":true,"taxable":true,"featured_image":{"id":34785986412643,"product_id":7920194453603,"position":15,"created_at":"2025-11-11T09:37:15+08:00","updated_at":"2025-11-11T09:37:17+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f8365e25fd006f91ed3c71a09313bd8d3baf6eb8_e7013682-e397-410b-a394-fa9fdad4726e.webp?v=1762825037","variant_ids":[43827895599203]},"available":true,"name":"iPhone 12 mini Mod NX Incrediville 怪奇事物所 所長的星際迷航 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118424-HD71","featured_media":{"alt":null,"id":26351443542115,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f8365e25fd006f91ed3c71a09313bd8d3baf6eb8_e7013682-e397-410b-a394-fa9fdad4726e.webp?v=1762825037"}},"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: "停產" }