$product = {"id":7892388839523,"title":"iPhone 15 Pro SolidX 小王子 小王子與狐狸 - 擁抱","handle":"iphone-15-pro-solidx-to55","description":null,"published_at":"2025-10-03T10:10:49+08:00","created_at":"2025-10-01T15:44:49+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-le-petit-prince","device-iPhone 15 Pro","merge","reseller-le-petit-prince"],"price":125000,"price_min":125000,"price_max":125000,"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":43755521704035,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"NST012970B-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542091567203,"product_id":7892388839523,"position":3,"created_at":"2025-10-01T15:44:55+08:00","updated_at":"2025-10-01T15:44:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c2826614770df87a29f5913223357832cd56ee5.webp?v=1759304698","variant_ids":[43755521704035]},"available":true,"name":"iPhone 15 Pro SolidX 小王子 小王子與狐狸 - 擁抱 - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST012970B-TO55","featured_media":{"alt":null,"id":26111856640099,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c2826614770df87a29f5913223357832cd56ee5.webp?v=1759304698"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755525013603,"title":"Seaweed Green","option1":"Seaweed Green","option2":null,"option3":null,"sku":"NST01297Z8-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542091894883,"product_id":7892388839523,"position":4,"created_at":"2025-10-01T15:44:56+08:00","updated_at":"2025-10-01T15:44:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9ed8717f994187353ce39c43fc288b3f83f110c.webp?v=1759304698","variant_ids":[43755525013603]},"available":true,"name":"iPhone 15 Pro SolidX 小王子 小王子與狐狸 - 擁抱 - Seaweed Green","public_title":"Seaweed Green","options":["Seaweed Green"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST01297Z8-TO55","featured_media":{"alt":null,"id":26111856967779,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9ed8717f994187353ce39c43fc288b3f83f110c.webp?v=1759304698"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755525046371,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NST0129753-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542092845155,"product_id":7892388839523,"position":7,"created_at":"2025-10-01T15:44:58+08:00","updated_at":"2025-10-01T15:45:00+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6b6d76bfc3329475638efa6c23b7bbfd5b3e101e.webp?v=1759304700","variant_ids":[43755525046371]},"available":true,"name":"iPhone 15 Pro SolidX 小王子 小王子與狐狸 - 擁抱 - White","public_title":"White","options":["White"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST0129753-TO55","featured_media":{"alt":null,"id":26111857918051,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6b6d76bfc3329475638efa6c23b7bbfd5b3e101e.webp?v=1759304700"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755525111907,"title":"Ocean Blue","option1":"Ocean Blue","option2":null,"option3":null,"sku":"NST012970A-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542093566051,"product_id":7892388839523,"position":9,"created_at":"2025-10-01T15:44:59+08:00","updated_at":"2025-10-01T15:45:01+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab6ab5c16939f9ccaf61908729d137b460ef5117.webp?v=1759304701","variant_ids":[43755525111907]},"available":true,"name":"iPhone 15 Pro SolidX 小王子 小王子與狐狸 - 擁抱 - Ocean Blue","public_title":"Ocean Blue","options":["Ocean Blue"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST012970A-TO55","featured_media":{"alt":null,"id":26111858638947,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab6ab5c16939f9ccaf61908729d137b460ef5117.webp?v=1759304701"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755525210211,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NST0129752-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542091305059,"product_id":7892388839523,"position":2,"created_at":"2025-10-01T15:44:51+08:00","updated_at":"2025-10-01T15:44:54+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a6cb0408110b8668dc5beb1b7f99bb18bc9b2e2.webp?v=1759304694","variant_ids":[43755525210211]},"available":true,"name":"iPhone 15 Pro SolidX 小王子 小王子與狐狸 - 擁抱 - Black","public_title":"Black","options":["Black"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST0129752-TO55","featured_media":{"alt":null,"id":26111856377955,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a6cb0408110b8668dc5beb1b7f99bb18bc9b2e2.webp?v=1759304694"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c1c6cb852716871fec86c304b76b4ac3d742f4ce.webp?v=1759304693","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a6cb0408110b8668dc5beb1b7f99bb18bc9b2e2.webp?v=1759304694","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c2826614770df87a29f5913223357832cd56ee5.webp?v=1759304698","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9ed8717f994187353ce39c43fc288b3f83f110c.webp?v=1759304698","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e3995e8004984b37f6ac4aa399fb0fe335630cd.webp?v=1759304700","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4c32c6c89bdb2fdb2dc0f33c929e0c1da48f6055.webp?v=1759304700","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6b6d76bfc3329475638efa6c23b7bbfd5b3e101e.webp?v=1759304700","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09fd4f65466ebad6bdb888a8125871fa0c5c239c.webp?v=1759304700","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab6ab5c16939f9ccaf61908729d137b460ef5117.webp?v=1759304701","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d38836b209508d34088e7741d4492a5b8b6d92ef.webp?v=1759304702"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c1c6cb852716871fec86c304b76b4ac3d742f4ce.webp?v=1759304693","options":["color"],"media":[{"alt":null,"id":26111856115811,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c1c6cb852716871fec86c304b76b4ac3d742f4ce.webp?v=1759304693"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c1c6cb852716871fec86c304b76b4ac3d742f4ce.webp?v=1759304693","width":2000},{"alt":null,"id":26111856377955,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a6cb0408110b8668dc5beb1b7f99bb18bc9b2e2.webp?v=1759304694"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a6cb0408110b8668dc5beb1b7f99bb18bc9b2e2.webp?v=1759304694","width":2000},{"alt":null,"id":26111856640099,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c2826614770df87a29f5913223357832cd56ee5.webp?v=1759304698"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c2826614770df87a29f5913223357832cd56ee5.webp?v=1759304698","width":2000},{"alt":null,"id":26111856967779,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9ed8717f994187353ce39c43fc288b3f83f110c.webp?v=1759304698"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9ed8717f994187353ce39c43fc288b3f83f110c.webp?v=1759304698","width":2000},{"alt":null,"id":26111857229923,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e3995e8004984b37f6ac4aa399fb0fe335630cd.webp?v=1759304700"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e3995e8004984b37f6ac4aa399fb0fe335630cd.webp?v=1759304700","width":2000},{"alt":null,"id":26111857623139,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4c32c6c89bdb2fdb2dc0f33c929e0c1da48f6055.webp?v=1759304700"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4c32c6c89bdb2fdb2dc0f33c929e0c1da48f6055.webp?v=1759304700","width":2000},{"alt":null,"id":26111857918051,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6b6d76bfc3329475638efa6c23b7bbfd5b3e101e.webp?v=1759304700"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6b6d76bfc3329475638efa6c23b7bbfd5b3e101e.webp?v=1759304700","width":2000},{"alt":null,"id":26111858180195,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09fd4f65466ebad6bdb888a8125871fa0c5c239c.webp?v=1759304700"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/09fd4f65466ebad6bdb888a8125871fa0c5c239c.webp?v=1759304700","width":2000},{"alt":null,"id":26111858638947,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab6ab5c16939f9ccaf61908729d137b460ef5117.webp?v=1759304701"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab6ab5c16939f9ccaf61908729d137b460ef5117.webp?v=1759304701","width":2000},{"alt":null,"id":26111858868323,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d38836b209508d34088e7741d4492a5b8b6d92ef.webp?v=1759304702"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d38836b209508d34088e7741d4492a5b8b6d92ef.webp?v=1759304702","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43755521704035,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"NST012970B-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542091567203,"product_id":7892388839523,"position":3,"created_at":"2025-10-01T15:44:55+08:00","updated_at":"2025-10-01T15:44:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c2826614770df87a29f5913223357832cd56ee5.webp?v=1759304698","variant_ids":[43755521704035]},"available":true,"name":"iPhone 15 Pro SolidX 小王子 小王子與狐狸 - 擁抱 - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST012970B-TO55","featured_media":{"alt":null,"id":26111856640099,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c2826614770df87a29f5913223357832cd56ee5.webp?v=1759304698"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755525013603,"title":"Seaweed Green","option1":"Seaweed Green","option2":null,"option3":null,"sku":"NST01297Z8-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542091894883,"product_id":7892388839523,"position":4,"created_at":"2025-10-01T15:44:56+08:00","updated_at":"2025-10-01T15:44:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9ed8717f994187353ce39c43fc288b3f83f110c.webp?v=1759304698","variant_ids":[43755525013603]},"available":true,"name":"iPhone 15 Pro SolidX 小王子 小王子與狐狸 - 擁抱 - Seaweed Green","public_title":"Seaweed Green","options":["Seaweed Green"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST01297Z8-TO55","featured_media":{"alt":null,"id":26111856967779,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b9ed8717f994187353ce39c43fc288b3f83f110c.webp?v=1759304698"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755525046371,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NST0129753-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542092845155,"product_id":7892388839523,"position":7,"created_at":"2025-10-01T15:44:58+08:00","updated_at":"2025-10-01T15:45:00+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6b6d76bfc3329475638efa6c23b7bbfd5b3e101e.webp?v=1759304700","variant_ids":[43755525046371]},"available":true,"name":"iPhone 15 Pro SolidX 小王子 小王子與狐狸 - 擁抱 - White","public_title":"White","options":["White"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST0129753-TO55","featured_media":{"alt":null,"id":26111857918051,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6b6d76bfc3329475638efa6c23b7bbfd5b3e101e.webp?v=1759304700"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755525111907,"title":"Ocean Blue","option1":"Ocean Blue","option2":null,"option3":null,"sku":"NST012970A-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542093566051,"product_id":7892388839523,"position":9,"created_at":"2025-10-01T15:44:59+08:00","updated_at":"2025-10-01T15:45:01+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab6ab5c16939f9ccaf61908729d137b460ef5117.webp?v=1759304701","variant_ids":[43755525111907]},"available":true,"name":"iPhone 15 Pro SolidX 小王子 小王子與狐狸 - 擁抱 - Ocean Blue","public_title":"Ocean Blue","options":["Ocean Blue"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST012970A-TO55","featured_media":{"alt":null,"id":26111858638947,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab6ab5c16939f9ccaf61908729d137b460ef5117.webp?v=1759304701"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43755525210211,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NST0129752-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542091305059,"product_id":7892388839523,"position":2,"created_at":"2025-10-01T15:44:51+08:00","updated_at":"2025-10-01T15:44:54+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a6cb0408110b8668dc5beb1b7f99bb18bc9b2e2.webp?v=1759304694","variant_ids":[43755525210211]},"available":true,"name":"iPhone 15 Pro SolidX 小王子 小王子與狐狸 - 擁抱 - Black","public_title":"Black","options":["Black"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST0129752-TO55","featured_media":{"alt":null,"id":26111856377955,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/4a6cb0408110b8668dc5beb1b7f99bb18bc9b2e2.webp?v=1759304694"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43755521704035,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"NST012970B-TO55","requires_shipping":true,"taxable":true,"featured_image":{"id":34542091567203,"product_id":7892388839523,"position":3,"created_at":"2025-10-01T15:44:55+08:00","updated_at":"2025-10-01T15:44:58+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c2826614770df87a29f5913223357832cd56ee5.webp?v=1759304698","variant_ids":[43755521704035]},"available":true,"name":"iPhone 15 Pro SolidX 小王子 小王子與狐狸 - 擁抱 - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":125000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NST012970B-TO55","featured_media":{"alt":null,"id":26111856640099,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c2826614770df87a29f5913223357832cd56ee5.webp?v=1759304698"}},"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: "停產" }