$product = {"id":7142408945763,"title":"iPhone 13 mini 犀牛盾SolidSuit (MagSafe 兼容)聯名設計款防摔背蓋手機殼 柴語錄 Shiba Says - 超不穩的疊疊樂","handle":"iphone-13-mini-solidsuit-classic-magsafe-fz05","description":null,"published_at":"2024-01-12T12:27:50+08:00","created_at":"2024-01-12T12:09:46+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"設計師SolidSuit MagSafe專區-柴語錄 Shiba Says","tags":["20%","20240304-reseller-\u003ereplace_to-","25%","30%","35%","40%","45%","50%","b2b","brand-Apple","designer","designer-shiba-says","device-iPhone 13 mini","merge","reseller-solidsuit-magsafe-shiba-says","Top50","type-Solidsuit MagSafe"],"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":41143619584099,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0122852-FZ05","requires_shipping":true,"taxable":true,"featured_image":{"id":30777028509795,"product_id":7142408945763,"position":13,"created_at":"2024-01-12T12:10:20+08:00","updated_at":"2024-01-12T12:10:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e7b07d89669ec04373550bd7f9a2f19dbbbfbffd.webp?v=1705032620","variant_ids":[41143619584099]},"available":true,"name":"iPhone 13 mini 犀牛盾SolidSuit (MagSafe 兼容)聯名設計款防摔背蓋手機殼 柴語錄 Shiba Says - 超不穩的疊疊樂 - Black","public_title":"Black","options":["Black"],"price":125000,"weight":1250,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-FZ05","featured_media":{"alt":null,"id":23146596237411,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e7b07d89669ec04373550bd7f9a2f19dbbbfbffd.webp?v=1705032620"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":41143619879011,"title":"Seaweed Green","option1":"Seaweed Green","option2":null,"option3":null,"sku":"MST01228Z8-FZ05","requires_shipping":true,"taxable":true,"featured_image":{"id":30777028837475,"product_id":7142408945763,"position":14,"created_at":"2024-01-12T12:10:23+08:00","updated_at":"2024-01-12T12:10:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9c8a7dd52fe363e555808970469b9fc747adaaa2.webp?v=1705032623","variant_ids":[41143619879011]},"available":true,"name":"iPhone 13 mini 犀牛盾SolidSuit (MagSafe 兼容)聯名設計款防摔背蓋手機殼 柴語錄 Shiba Says - 超不穩的疊疊樂 - Seaweed Green","public_title":"Seaweed Green","options":["Seaweed Green"],"price":125000,"weight":1250,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01228Z8-FZ05","featured_media":{"alt":null,"id":23146596565091,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9c8a7dd52fe363e555808970469b9fc747adaaa2.webp?v=1705032623"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":41143619911779,"title":"Tide Blue","option1":"Tide Blue","option2":null,"option3":null,"sku":"MST01228Z9-FZ05","requires_shipping":true,"taxable":true,"featured_image":{"id":30777027362915,"product_id":7142408945763,"position":10,"created_at":"2024-01-12T12:10:14+08:00","updated_at":"2024-01-12T12:10:14+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13e1e5de8f7232d8749ea8761373e34d02b7e8dc.webp?v=1705032614","variant_ids":[41143619911779]},"available":true,"name":"iPhone 13 mini 犀牛盾SolidSuit (MagSafe 兼容)聯名設計款防摔背蓋手機殼 柴語錄 Shiba Says - 超不穩的疊疊樂 - Tide Blue","public_title":"Tide Blue","options":["Tide Blue"],"price":125000,"weight":1250,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01228Z9-FZ05","featured_media":{"alt":null,"id":23146595090531,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13e1e5de8f7232d8749ea8761373e34d02b7e8dc.webp?v=1705032614"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/62bafd50a0cde6062b815bf9d3d2b49c4aa6a706.webp?v=1705032594","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5f16ea79f56d09a420a0b09f3beed03017c3c50.webp?v=1705032596","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/db8d9e9aaa0265ecacb80bd473403cd272d05e87.webp?v=1705032598","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b8f064bf92f4f56287d1a34b2b3c7df8eec0c3c.webp?v=1705032600","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1ebb69bd2d74c3e4b9bfe54f9e85a0a3fa64c62.webp?v=1705032603","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bd004b57f071edf26fd0480495b8d65dedc59f5.webp?v=1705032605","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b82678443241ecf631a206694b204afaaa25df.webp?v=1705032607","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d3e7e26a1c8a35f0d8e62f6b9c1839b1aeb52c92.webp?v=1705032609","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c3c912ce6425b38dd3173c4beb3131f46fae7c14.webp?v=1705032612","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13e1e5de8f7232d8749ea8761373e34d02b7e8dc.webp?v=1705032614","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd66aeb695bc411f097f0d5af764a7298dd45e0e.webp?v=1705032616","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5e91a39dc3323131cdf1f2e0d243e95ace1b758e.webp?v=1705032618","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e7b07d89669ec04373550bd7f9a2f19dbbbfbffd.webp?v=1705032620","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9c8a7dd52fe363e555808970469b9fc747adaaa2.webp?v=1705032623","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0640d2fd0395f4d2f552bcfddaa3e2864d77cd74.webp?v=1705032625","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7ca7deabefbc268cff309d9a66bc398d74df0fed.webp?v=1705032627"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/62bafd50a0cde6062b815bf9d3d2b49c4aa6a706.webp?v=1705032594","options":["color"],"media":[{"alt":null,"id":23146591158371,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/62bafd50a0cde6062b815bf9d3d2b49c4aa6a706.webp?v=1705032594"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/62bafd50a0cde6062b815bf9d3d2b49c4aa6a706.webp?v=1705032594","width":2000},{"alt":null,"id":23146591518819,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5f16ea79f56d09a420a0b09f3beed03017c3c50.webp?v=1705032596"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5f16ea79f56d09a420a0b09f3beed03017c3c50.webp?v=1705032596","width":2000},{"alt":null,"id":23146592010339,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/db8d9e9aaa0265ecacb80bd473403cd272d05e87.webp?v=1705032598"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/db8d9e9aaa0265ecacb80bd473403cd272d05e87.webp?v=1705032598","width":2000},{"alt":null,"id":23146592469091,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b8f064bf92f4f56287d1a34b2b3c7df8eec0c3c.webp?v=1705032600"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b8f064bf92f4f56287d1a34b2b3c7df8eec0c3c.webp?v=1705032600","width":2000},{"alt":null,"id":23146592960611,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1ebb69bd2d74c3e4b9bfe54f9e85a0a3fa64c62.webp?v=1705032603"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f1ebb69bd2d74c3e4b9bfe54f9e85a0a3fa64c62.webp?v=1705032603","width":2000},{"alt":null,"id":23146593484899,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bd004b57f071edf26fd0480495b8d65dedc59f5.webp?v=1705032605"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7bd004b57f071edf26fd0480495b8d65dedc59f5.webp?v=1705032605","width":2000},{"alt":null,"id":23146593878115,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b82678443241ecf631a206694b204afaaa25df.webp?v=1705032607"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b82678443241ecf631a206694b204afaaa25df.webp?v=1705032607","width":2000},{"alt":null,"id":23146594304099,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d3e7e26a1c8a35f0d8e62f6b9c1839b1aeb52c92.webp?v=1705032609"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d3e7e26a1c8a35f0d8e62f6b9c1839b1aeb52c92.webp?v=1705032609","width":2000},{"alt":null,"id":23146594664547,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c3c912ce6425b38dd3173c4beb3131f46fae7c14.webp?v=1705032612"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c3c912ce6425b38dd3173c4beb3131f46fae7c14.webp?v=1705032612","width":2000},{"alt":null,"id":23146595090531,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13e1e5de8f7232d8749ea8761373e34d02b7e8dc.webp?v=1705032614"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13e1e5de8f7232d8749ea8761373e34d02b7e8dc.webp?v=1705032614","width":2000},{"alt":null,"id":23146595450979,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd66aeb695bc411f097f0d5af764a7298dd45e0e.webp?v=1705032616"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd66aeb695bc411f097f0d5af764a7298dd45e0e.webp?v=1705032616","width":2000},{"alt":null,"id":23146595909731,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5e91a39dc3323131cdf1f2e0d243e95ace1b758e.webp?v=1705032618"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5e91a39dc3323131cdf1f2e0d243e95ace1b758e.webp?v=1705032618","width":2000},{"alt":null,"id":23146596237411,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e7b07d89669ec04373550bd7f9a2f19dbbbfbffd.webp?v=1705032620"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e7b07d89669ec04373550bd7f9a2f19dbbbfbffd.webp?v=1705032620","width":2000},{"alt":null,"id":23146596565091,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9c8a7dd52fe363e555808970469b9fc747adaaa2.webp?v=1705032623"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9c8a7dd52fe363e555808970469b9fc747adaaa2.webp?v=1705032623","width":2000},{"alt":null,"id":23146596958307,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0640d2fd0395f4d2f552bcfddaa3e2864d77cd74.webp?v=1705032625"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0640d2fd0395f4d2f552bcfddaa3e2864d77cd74.webp?v=1705032625","width":2000},{"alt":null,"id":23146598105187,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7ca7deabefbc268cff309d9a66bc398d74df0fed.webp?v=1705032627"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7ca7deabefbc268cff309d9a66bc398d74df0fed.webp?v=1705032627","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":41143619584099,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0122852-FZ05","requires_shipping":true,"taxable":true,"featured_image":{"id":30777028509795,"product_id":7142408945763,"position":13,"created_at":"2024-01-12T12:10:20+08:00","updated_at":"2024-01-12T12:10:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e7b07d89669ec04373550bd7f9a2f19dbbbfbffd.webp?v=1705032620","variant_ids":[41143619584099]},"available":true,"name":"iPhone 13 mini 犀牛盾SolidSuit (MagSafe 兼容)聯名設計款防摔背蓋手機殼 柴語錄 Shiba Says - 超不穩的疊疊樂 - Black","public_title":"Black","options":["Black"],"price":125000,"weight":1250,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-FZ05","featured_media":{"alt":null,"id":23146596237411,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e7b07d89669ec04373550bd7f9a2f19dbbbfbffd.webp?v=1705032620"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":41143619879011,"title":"Seaweed Green","option1":"Seaweed Green","option2":null,"option3":null,"sku":"MST01228Z8-FZ05","requires_shipping":true,"taxable":true,"featured_image":{"id":30777028837475,"product_id":7142408945763,"position":14,"created_at":"2024-01-12T12:10:23+08:00","updated_at":"2024-01-12T12:10:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9c8a7dd52fe363e555808970469b9fc747adaaa2.webp?v=1705032623","variant_ids":[41143619879011]},"available":true,"name":"iPhone 13 mini 犀牛盾SolidSuit (MagSafe 兼容)聯名設計款防摔背蓋手機殼 柴語錄 Shiba Says - 超不穩的疊疊樂 - Seaweed Green","public_title":"Seaweed Green","options":["Seaweed Green"],"price":125000,"weight":1250,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01228Z8-FZ05","featured_media":{"alt":null,"id":23146596565091,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9c8a7dd52fe363e555808970469b9fc747adaaa2.webp?v=1705032623"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":41143619911779,"title":"Tide Blue","option1":"Tide Blue","option2":null,"option3":null,"sku":"MST01228Z9-FZ05","requires_shipping":true,"taxable":true,"featured_image":{"id":30777027362915,"product_id":7142408945763,"position":10,"created_at":"2024-01-12T12:10:14+08:00","updated_at":"2024-01-12T12:10:14+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13e1e5de8f7232d8749ea8761373e34d02b7e8dc.webp?v=1705032614","variant_ids":[41143619911779]},"available":true,"name":"iPhone 13 mini 犀牛盾SolidSuit (MagSafe 兼容)聯名設計款防摔背蓋手機殼 柴語錄 Shiba Says - 超不穩的疊疊樂 - Tide Blue","public_title":"Tide Blue","options":["Tide Blue"],"price":125000,"weight":1250,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01228Z9-FZ05","featured_media":{"alt":null,"id":23146595090531,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/13e1e5de8f7232d8749ea8761373e34d02b7e8dc.webp?v=1705032614"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":41143619584099,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MST0122852-FZ05","requires_shipping":true,"taxable":true,"featured_image":{"id":30777028509795,"product_id":7142408945763,"position":13,"created_at":"2024-01-12T12:10:20+08:00","updated_at":"2024-01-12T12:10:20+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e7b07d89669ec04373550bd7f9a2f19dbbbfbffd.webp?v=1705032620","variant_ids":[41143619584099]},"available":true,"name":"iPhone 13 mini 犀牛盾SolidSuit (MagSafe 兼容)聯名設計款防摔背蓋手機殼 柴語錄 Shiba Says - 超不穩的疊疊樂 - Black","public_title":"Black","options":["Black"],"price":125000,"weight":1250,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-FZ05","featured_media":{"alt":null,"id":23146596237411,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e7b07d89669ec04373550bd7f9a2f19dbbbfbffd.webp?v=1705032620"}},"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: "停產" }