$product = {"id":7911278149731,"title":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad 樹","handle":"iphone-12-pro-mod-nx-magsafe-printable-pos09","description":null,"published_at":"2025-11-05T10:35:16+08:00","created_at":"2025-11-04T10:49:32+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-posterlad","device-iPhone 12 Pro","merge","reseller-posterlad"],"price":110000,"price_min":110000,"price_max":110000,"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":43812183244899,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729302622307,"product_id":7911278149731,"position":9,"created_at":"2025-11-04T10:49:45+08:00","updated_at":"2025-11-04T10:49:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/522be5e16af3f0aa7ebd477c711020afd3f4fbdb.webp?v=1762224587","variant_ids":[43812183244899]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad 樹 - Lavender","public_title":"Lavender","options":["Lavender"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185C1-POS09","featured_media":{"alt":null,"id":26297170722915,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/522be5e16af3f0aa7ebd477c711020afd3f4fbdb.webp?v=1762224587"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812186882147,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729301704803,"product_id":7911278149731,"position":4,"created_at":"2025-11-04T10:49:39+08:00","updated_at":"2025-11-04T10:49:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bba267215f9df14e62ab8d5049b7a32a7f1434c2.webp?v=1762224581","variant_ids":[43812186882147]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad 樹 - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118524-POS09","featured_media":{"alt":null,"id":26297169838179,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bba267215f9df14e62ab8d5049b7a32a7f1434c2.webp?v=1762224581"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812186914915,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729302851683,"product_id":7911278149731,"position":10,"created_at":"2025-11-04T10:49:47+08:00","updated_at":"2025-11-04T10:49:49+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/74e0b14ddc359372f3aa34609962cbd458077abe.webp?v=1762224589","variant_ids":[43812186914915]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad 樹 - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185J5-POS09","featured_media":{"alt":null,"id":26297170985059,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/74e0b14ddc359372f3aa34609962cbd458077abe.webp?v=1762224589"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812186947683,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729302130787,"product_id":7911278149731,"position":6,"created_at":"2025-11-04T10:49:42+08:00","updated_at":"2025-11-04T10:49:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bb64d4b423bbe88999db9bb75e4d1f1e086e328c.webp?v=1762224584","variant_ids":[43812186947683]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad 樹 - Graphite","public_title":"Graphite","options":["Graphite"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118569-POS09","featured_media":{"alt":null,"id":26297170198627,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bb64d4b423bbe88999db9bb75e4d1f1e086e328c.webp?v=1762224584"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812187144291,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729302392931,"product_id":7911278149731,"position":8,"created_at":"2025-11-04T10:49:44+08:00","updated_at":"2025-11-04T10:49:46+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fc235d216fcfc2a7a85d5199f034fc4ae10ed578.webp?v=1762224586","variant_ids":[43812187144291]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad 樹 - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118504-POS09","featured_media":{"alt":null,"id":26297170526307,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fc235d216fcfc2a7a85d5199f034fc4ae10ed578.webp?v=1762224586"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd812d6a9ebe085b023e29cbdffe6e0fc10033ab.webp?v=1762224578","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4edc1250e5d276f96c8d7cbf323bc041f62db24.webp?v=1762224579","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/330a5816374ad21ad82485f038322b3a71a344fb.webp?v=1762224580","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bba267215f9df14e62ab8d5049b7a32a7f1434c2.webp?v=1762224581","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/96ff9ad0ca58e50dc7308336b98eb9e2291e7610.webp?v=1762224582","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bb64d4b423bbe88999db9bb75e4d1f1e086e328c.webp?v=1762224584","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/92fc0b3f9b6dd0d91c3ab52b9ebcdb4fc86259a0.webp?v=1762224585","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fc235d216fcfc2a7a85d5199f034fc4ae10ed578.webp?v=1762224586","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/522be5e16af3f0aa7ebd477c711020afd3f4fbdb.webp?v=1762224587","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/74e0b14ddc359372f3aa34609962cbd458077abe.webp?v=1762224589","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9428c7755fa8d2b41b8adc13046394202bc412e9.webp?v=1762224590"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd812d6a9ebe085b023e29cbdffe6e0fc10033ab.webp?v=1762224578","options":["color"],"media":[{"alt":null,"id":26297169018979,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd812d6a9ebe085b023e29cbdffe6e0fc10033ab.webp?v=1762224578"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/dd812d6a9ebe085b023e29cbdffe6e0fc10033ab.webp?v=1762224578","width":2000},{"alt":null,"id":26297169313891,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4edc1250e5d276f96c8d7cbf323bc041f62db24.webp?v=1762224579"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f4edc1250e5d276f96c8d7cbf323bc041f62db24.webp?v=1762224579","width":2000},{"alt":null,"id":26297169543267,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/330a5816374ad21ad82485f038322b3a71a344fb.webp?v=1762224580"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/330a5816374ad21ad82485f038322b3a71a344fb.webp?v=1762224580","width":2000},{"alt":null,"id":26297169838179,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bba267215f9df14e62ab8d5049b7a32a7f1434c2.webp?v=1762224581"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bba267215f9df14e62ab8d5049b7a32a7f1434c2.webp?v=1762224581","width":2000},{"alt":null,"id":26297170034787,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/96ff9ad0ca58e50dc7308336b98eb9e2291e7610.webp?v=1762224582"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/96ff9ad0ca58e50dc7308336b98eb9e2291e7610.webp?v=1762224582","width":2000},{"alt":null,"id":26297170198627,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bb64d4b423bbe88999db9bb75e4d1f1e086e328c.webp?v=1762224584"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bb64d4b423bbe88999db9bb75e4d1f1e086e328c.webp?v=1762224584","width":2000},{"alt":null,"id":26297170296931,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/92fc0b3f9b6dd0d91c3ab52b9ebcdb4fc86259a0.webp?v=1762224585"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/92fc0b3f9b6dd0d91c3ab52b9ebcdb4fc86259a0.webp?v=1762224585","width":2000},{"alt":null,"id":26297170526307,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fc235d216fcfc2a7a85d5199f034fc4ae10ed578.webp?v=1762224586"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fc235d216fcfc2a7a85d5199f034fc4ae10ed578.webp?v=1762224586","width":2000},{"alt":null,"id":26297170722915,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/522be5e16af3f0aa7ebd477c711020afd3f4fbdb.webp?v=1762224587"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/522be5e16af3f0aa7ebd477c711020afd3f4fbdb.webp?v=1762224587","width":2000},{"alt":null,"id":26297170985059,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/74e0b14ddc359372f3aa34609962cbd458077abe.webp?v=1762224589"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/74e0b14ddc359372f3aa34609962cbd458077abe.webp?v=1762224589","width":2000},{"alt":null,"id":26297171148899,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9428c7755fa8d2b41b8adc13046394202bc412e9.webp?v=1762224590"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9428c7755fa8d2b41b8adc13046394202bc412e9.webp?v=1762224590","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null}; $isMerge = null; $variants = [{"id":43812183244899,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729302622307,"product_id":7911278149731,"position":9,"created_at":"2025-11-04T10:49:45+08:00","updated_at":"2025-11-04T10:49:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/522be5e16af3f0aa7ebd477c711020afd3f4fbdb.webp?v=1762224587","variant_ids":[43812183244899]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad 樹 - Lavender","public_title":"Lavender","options":["Lavender"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185C1-POS09","featured_media":{"alt":null,"id":26297170722915,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/522be5e16af3f0aa7ebd477c711020afd3f4fbdb.webp?v=1762224587"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812186882147,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729301704803,"product_id":7911278149731,"position":4,"created_at":"2025-11-04T10:49:39+08:00","updated_at":"2025-11-04T10:49:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bba267215f9df14e62ab8d5049b7a32a7f1434c2.webp?v=1762224581","variant_ids":[43812186882147]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad 樹 - Black","public_title":"Black","options":["Black"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118524-POS09","featured_media":{"alt":null,"id":26297169838179,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bba267215f9df14e62ab8d5049b7a32a7f1434c2.webp?v=1762224581"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812186914915,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729302851683,"product_id":7911278149731,"position":10,"created_at":"2025-11-04T10:49:47+08:00","updated_at":"2025-11-04T10:49:49+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/74e0b14ddc359372f3aa34609962cbd458077abe.webp?v=1762224589","variant_ids":[43812186914915]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad 樹 - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185J5-POS09","featured_media":{"alt":null,"id":26297170985059,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/74e0b14ddc359372f3aa34609962cbd458077abe.webp?v=1762224589"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812186947683,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729302130787,"product_id":7911278149731,"position":6,"created_at":"2025-11-04T10:49:42+08:00","updated_at":"2025-11-04T10:49:44+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bb64d4b423bbe88999db9bb75e4d1f1e086e328c.webp?v=1762224584","variant_ids":[43812186947683]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad 樹 - Graphite","public_title":"Graphite","options":["Graphite"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118569-POS09","featured_media":{"alt":null,"id":26297170198627,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/bb64d4b423bbe88999db9bb75e4d1f1e086e328c.webp?v=1762224584"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43812187144291,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729302392931,"product_id":7911278149731,"position":8,"created_at":"2025-11-04T10:49:44+08:00","updated_at":"2025-11-04T10:49:46+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fc235d216fcfc2a7a85d5199f034fc4ae10ed578.webp?v=1762224586","variant_ids":[43812187144291]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad 樹 - White","public_title":"White","options":["White"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB0118504-POS09","featured_media":{"alt":null,"id":26297170526307,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/fc235d216fcfc2a7a85d5199f034fc4ae10ed578.webp?v=1762224586"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}]; $defaultVariant = {"id":43812183244899,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-POS09","requires_shipping":true,"taxable":true,"featured_image":{"id":34729302622307,"product_id":7911278149731,"position":9,"created_at":"2025-11-04T10:49:45+08:00","updated_at":"2025-11-04T10:49:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/522be5e16af3f0aa7ebd477c711020afd3f4fbdb.webp?v=1762224587","variant_ids":[43812183244899]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) PosterLad 樹 - Lavender","public_title":"Lavender","options":["Lavender"],"price":110000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"MPB01185C1-POS09","featured_media":{"alt":null,"id":26297170722915,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/522be5e16af3f0aa7ebd477c711020afd3f4fbdb.webp?v=1762224587"}},"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: "停產" }