$product = {"id":6983948927075,"title":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA 塗鴉系列-波士頓塞爾提克 Boston Celtics - Graffiti","handle":"iphone-13-mini-solidsuit-classic-magsafe-pm77","description":null,"published_at":"2023-08-02T22:25:05+08:00","created_at":"2023-07-28T13:08:34+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"設計師SolidSuit MagSafe專區-哈利波特 Harry Potter","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-nba","device-iPhone 13 Mini","merge","reseller-nba"],"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":43101672538211,"title":"Black \/ Classic","option1":"Black","option2":"Classic","option3":null,"sku":"MST0122852-PM77","requires_shipping":true,"taxable":true,"featured_image":{"id":30278562447459,"product_id":6983948927075,"position":1,"created_at":"2023-07-28T13:08:37+08:00","updated_at":"2023-07-28T13:08:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM77_e13c7bd1-561c-4458-a664-f7ce387d2f77.png?v=1690520917","variant_ids":[43101672538211,43101672702051]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA 塗鴉系列-波士頓塞爾提克 Boston Celtics - Graffiti - Black \/ Classic","public_title":"Black \/ Classic","options":["Black","Classic"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-PM77","featured_media":{"alt":null,"id":22637194674275,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM77_e13c7bd1-561c-4458-a664-f7ce387d2f77.png?v=1690520917"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43101672702051,"title":"Seaweed Green \/ Classic","option1":"Seaweed Green","option2":"Classic","option3":null,"sku":"MST01228Z8-PM77","requires_shipping":true,"taxable":true,"featured_image":{"id":30278562447459,"product_id":6983948927075,"position":1,"created_at":"2023-07-28T13:08:37+08:00","updated_at":"2023-07-28T13:08:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM77_e13c7bd1-561c-4458-a664-f7ce387d2f77.png?v=1690520917","variant_ids":[43101672538211,43101672702051]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA 塗鴉系列-波士頓塞爾提克 Boston Celtics - Graffiti - Seaweed Green \/ Classic","public_title":"Seaweed Green \/ Classic","options":["Seaweed Green","Classic"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01228Z8-PM77","featured_media":{"alt":null,"id":22637194674275,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM77_e13c7bd1-561c-4458-a664-f7ce387d2f77.png?v=1690520917"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM77_e13c7bd1-561c-4458-a664-f7ce387d2f77.png?v=1690520917","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/797db355f48304b37be3b570c34e55275a9c2312.webp?v=1782205172","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14933d96706a1e8e8596184a363c45d74c8550d2.webp?v=1782205172","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b24ae9c6b02e65d0d59af7b993ab1cb0bde4499.webp?v=1782205173","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a873ef5461c192e98f288089615d0534be80621.webp?v=1782205174","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/797db355f48304b37be3b570c34e55275a9c2312_039526dc-a361-4bc1-8a7d-72862bc0f29b.webp?v=1782218451","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14933d96706a1e8e8596184a363c45d74c8550d2_169c976e-815b-43ae-8795-acbe953f5ec9.webp?v=1782218451","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b24ae9c6b02e65d0d59af7b993ab1cb0bde4499_c861dcf6-13ae-4ec5-a917-015dce15e486.webp?v=1782218452","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a873ef5461c192e98f288089615d0534be80621_dc3fe4a5-e7c8-48b4-bf21-e66ed7e2934a.webp?v=1782218452","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/797db355f48304b37be3b570c34e55275a9c2312_001f120d-8c83-4bbd-81ca-b9096deea522.webp?v=1782218773","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14933d96706a1e8e8596184a363c45d74c8550d2_66e4858c-fb87-49d3-bd61-6bf070d5d1c6.webp?v=1782218773","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b24ae9c6b02e65d0d59af7b993ab1cb0bde4499_2ab856e5-67d6-4e09-9889-eee9f0d9c528.webp?v=1782218774","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a873ef5461c192e98f288089615d0534be80621_ead327a1-df90-40f3-9c48-64737d726fc1.webp?v=1782218774","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/797db355f48304b37be3b570c34e55275a9c2312_718538a7-5221-43c0-8a24-6eb6d0ebccf2.webp?v=1782219060","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14933d96706a1e8e8596184a363c45d74c8550d2_0687caff-22c1-467e-94d9-c4a3b8321873.webp?v=1782219061","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b24ae9c6b02e65d0d59af7b993ab1cb0bde4499_7e2c5550-08d8-4255-b2af-0555983b60c3.webp?v=1782219062","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a873ef5461c192e98f288089615d0534be80621_676d7350-87ce-4094-9cef-243dc79b8d3e.webp?v=1782219063"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM77_e13c7bd1-561c-4458-a664-f7ce387d2f77.png?v=1690520917","options":["color","Types"],"media":[{"alt":null,"id":22637194674275,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM77_e13c7bd1-561c-4458-a664-f7ce387d2f77.png?v=1690520917"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM77_e13c7bd1-561c-4458-a664-f7ce387d2f77.png?v=1690520917","width":2000},{"alt":null,"id":27575150739555,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/797db355f48304b37be3b570c34e55275a9c2312.webp?v=1782205172"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/797db355f48304b37be3b570c34e55275a9c2312.webp?v=1782205172","width":2000},{"alt":null,"id":27575150903395,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14933d96706a1e8e8596184a363c45d74c8550d2.webp?v=1782205172"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14933d96706a1e8e8596184a363c45d74c8550d2.webp?v=1782205172","width":2000},{"alt":null,"id":27575151001699,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b24ae9c6b02e65d0d59af7b993ab1cb0bde4499.webp?v=1782205173"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b24ae9c6b02e65d0d59af7b993ab1cb0bde4499.webp?v=1782205173","width":2000},{"alt":null,"id":27575151132771,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a873ef5461c192e98f288089615d0534be80621.webp?v=1782205174"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a873ef5461c192e98f288089615d0534be80621.webp?v=1782205174","width":2000},{"alt":null,"id":27581469818979,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/797db355f48304b37be3b570c34e55275a9c2312_039526dc-a361-4bc1-8a7d-72862bc0f29b.webp?v=1782218451"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/797db355f48304b37be3b570c34e55275a9c2312_039526dc-a361-4bc1-8a7d-72862bc0f29b.webp?v=1782218451","width":2000},{"alt":null,"id":27581470244963,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14933d96706a1e8e8596184a363c45d74c8550d2_169c976e-815b-43ae-8795-acbe953f5ec9.webp?v=1782218451"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14933d96706a1e8e8596184a363c45d74c8550d2_169c976e-815b-43ae-8795-acbe953f5ec9.webp?v=1782218451","width":2000},{"alt":null,"id":27581470343267,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b24ae9c6b02e65d0d59af7b993ab1cb0bde4499_c861dcf6-13ae-4ec5-a917-015dce15e486.webp?v=1782218452"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b24ae9c6b02e65d0d59af7b993ab1cb0bde4499_c861dcf6-13ae-4ec5-a917-015dce15e486.webp?v=1782218452","width":2000},{"alt":null,"id":27581470474339,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a873ef5461c192e98f288089615d0534be80621_dc3fe4a5-e7c8-48b4-bf21-e66ed7e2934a.webp?v=1782218452"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a873ef5461c192e98f288089615d0534be80621_dc3fe4a5-e7c8-48b4-bf21-e66ed7e2934a.webp?v=1782218452","width":2000},{"alt":null,"id":27581646635107,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/797db355f48304b37be3b570c34e55275a9c2312_001f120d-8c83-4bbd-81ca-b9096deea522.webp?v=1782218773"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/797db355f48304b37be3b570c34e55275a9c2312_001f120d-8c83-4bbd-81ca-b9096deea522.webp?v=1782218773","width":2000},{"alt":null,"id":27581646864483,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14933d96706a1e8e8596184a363c45d74c8550d2_66e4858c-fb87-49d3-bd61-6bf070d5d1c6.webp?v=1782218773"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14933d96706a1e8e8596184a363c45d74c8550d2_66e4858c-fb87-49d3-bd61-6bf070d5d1c6.webp?v=1782218773","width":2000},{"alt":null,"id":27581647192163,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b24ae9c6b02e65d0d59af7b993ab1cb0bde4499_2ab856e5-67d6-4e09-9889-eee9f0d9c528.webp?v=1782218774"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b24ae9c6b02e65d0d59af7b993ab1cb0bde4499_2ab856e5-67d6-4e09-9889-eee9f0d9c528.webp?v=1782218774","width":2000},{"alt":null,"id":27581647454307,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a873ef5461c192e98f288089615d0534be80621_ead327a1-df90-40f3-9c48-64737d726fc1.webp?v=1782218774"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a873ef5461c192e98f288089615d0534be80621_ead327a1-df90-40f3-9c48-64737d726fc1.webp?v=1782218774","width":2000},{"alt":null,"id":27581791207523,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/797db355f48304b37be3b570c34e55275a9c2312_718538a7-5221-43c0-8a24-6eb6d0ebccf2.webp?v=1782219060"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/797db355f48304b37be3b570c34e55275a9c2312_718538a7-5221-43c0-8a24-6eb6d0ebccf2.webp?v=1782219060","width":2000},{"alt":null,"id":27581791371363,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14933d96706a1e8e8596184a363c45d74c8550d2_0687caff-22c1-467e-94d9-c4a3b8321873.webp?v=1782219061"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/14933d96706a1e8e8596184a363c45d74c8550d2_0687caff-22c1-467e-94d9-c4a3b8321873.webp?v=1782219061","width":2000},{"alt":null,"id":27581791535203,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b24ae9c6b02e65d0d59af7b993ab1cb0bde4499_7e2c5550-08d8-4255-b2af-0555983b60c3.webp?v=1782219062"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3b24ae9c6b02e65d0d59af7b993ab1cb0bde4499_7e2c5550-08d8-4255-b2af-0555983b60c3.webp?v=1782219062","width":2000},{"alt":null,"id":27581791731811,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a873ef5461c192e98f288089615d0534be80621_676d7350-87ce-4094-9cef-243dc79b8d3e.webp?v=1782219063"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2a873ef5461c192e98f288089615d0534be80621_676d7350-87ce-4094-9cef-243dc79b8d3e.webp?v=1782219063","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43101672538211,"title":"Black \/ Classic","option1":"Black","option2":"Classic","option3":null,"sku":"MST0122852-PM77","requires_shipping":true,"taxable":true,"featured_image":{"id":30278562447459,"product_id":6983948927075,"position":1,"created_at":"2023-07-28T13:08:37+08:00","updated_at":"2023-07-28T13:08:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM77_e13c7bd1-561c-4458-a664-f7ce387d2f77.png?v=1690520917","variant_ids":[43101672538211,43101672702051]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA 塗鴉系列-波士頓塞爾提克 Boston Celtics - Graffiti - Black \/ Classic","public_title":"Black \/ Classic","options":["Black","Classic"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-PM77","featured_media":{"alt":null,"id":22637194674275,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM77_e13c7bd1-561c-4458-a664-f7ce387d2f77.png?v=1690520917"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43101672702051,"title":"Seaweed Green \/ Classic","option1":"Seaweed Green","option2":"Classic","option3":null,"sku":"MST01228Z8-PM77","requires_shipping":true,"taxable":true,"featured_image":{"id":30278562447459,"product_id":6983948927075,"position":1,"created_at":"2023-07-28T13:08:37+08:00","updated_at":"2023-07-28T13:08:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM77_e13c7bd1-561c-4458-a664-f7ce387d2f77.png?v=1690520917","variant_ids":[43101672538211,43101672702051]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA 塗鴉系列-波士頓塞爾提克 Boston Celtics - Graffiti - Seaweed Green \/ Classic","public_title":"Seaweed Green \/ Classic","options":["Seaweed Green","Classic"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST01228Z8-PM77","featured_media":{"alt":null,"id":22637194674275,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM77_e13c7bd1-561c-4458-a664-f7ce387d2f77.png?v=1690520917"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43101672538211,"title":"Black \/ Classic","option1":"Black","option2":"Classic","option3":null,"sku":"MST0122852-PM77","requires_shipping":true,"taxable":true,"featured_image":{"id":30278562447459,"product_id":6983948927075,"position":1,"created_at":"2023-07-28T13:08:37+08:00","updated_at":"2023-07-28T13:08:37+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM77_e13c7bd1-561c-4458-a664-f7ce387d2f77.png?v=1690520917","variant_ids":[43101672538211,43101672702051]},"available":true,"name":"iPhone 13 mini SolidSuit (MagSafe 兼容) NBA 塗鴉系列-波士頓塞爾提克 Boston Celtics - Graffiti - Black \/ Classic","public_title":"Black \/ Classic","options":["Black","Classic"],"price":125000,"weight":1350,"compare_at_price":null,"inventory_quantity":2500,"inventory_management":null,"inventory_policy":"deny","barcode":"MST0122852-PM77","featured_media":{"alt":null,"id":22637194674275,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/SolidSuitTPE-53-228-PM77_e13c7bd1-561c-4458-a664-f7ce387d2f77.png?v=1690520917"}},"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: "停產" }