$product = {"id":7848090730595,"title":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Selfie Time","handle":"iphone-12-pro-mod-nx-magsafe-bumper-crossover-design-fv66","description":null,"published_at":"2025-08-07T09:04:11+08:00","created_at":"2025-08-05T09:47:37+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-hijohnnn","device-iPhone 12 Pro","merge","reseller-hijohnnn"],"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":43563011473507,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-FV66","requires_shipping":true,"taxable":true,"featured_image":{"id":34288040050787,"product_id":7848090730595,"position":10,"created_at":"2025-08-05T09:47:49+08:00","updated_at":"2025-08-05T09:47:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26547c437550d4ced7e67a4d94ba1a7c868875d2.webp?v=1754358472","variant_ids":[43563011473507]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Selfie Time - 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-FV66","featured_media":{"alt":null,"id":25888969982051,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26547c437550d4ced7e67a4d94ba1a7c868875d2.webp?v=1754358472"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43563015209059,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-FV66","requires_shipping":true,"taxable":true,"featured_image":{"id":34288038412387,"product_id":7848090730595,"position":5,"created_at":"2025-08-05T09:47:47+08:00","updated_at":"2025-08-05T09:47:49+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/32ab68d43940f7c85a973938bceda51d65873269.webp?v=1754358469","variant_ids":[43563015209059]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Selfie Time - 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-FV66","featured_media":{"alt":null,"id":25888969162851,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/32ab68d43940f7c85a973938bceda51d65873269.webp?v=1754358469"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43563015274595,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-FV66","requires_shipping":true,"taxable":true,"featured_image":{"id":34288037789795,"product_id":7848090730595,"position":3,"created_at":"2025-08-05T09:47:46+08:00","updated_at":"2025-08-05T09:47:48+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0f0785fab4b5fcdab5bb0d9045511cded7d60cae.webp?v=1754358468","variant_ids":[43563015274595]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Selfie Time - 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-FV66","featured_media":{"alt":null,"id":25888968966243,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0f0785fab4b5fcdab5bb0d9045511cded7d60cae.webp?v=1754358468"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43563015372899,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-FV66","requires_shipping":true,"taxable":true,"featured_image":{"id":34288039329891,"product_id":7848090730595,"position":8,"created_at":"2025-08-05T09:47:48+08:00","updated_at":"2025-08-05T09:47:51+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7256473ea666ff86d0bb1878342b5ee6c209f7cd.webp?v=1754358471","variant_ids":[43563015372899]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Selfie Time - 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-FV66","featured_media":{"alt":null,"id":25888969621603,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7256473ea666ff86d0bb1878342b5ee6c209f7cd.webp?v=1754358471"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43563015471203,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-FV66","requires_shipping":true,"taxable":true,"featured_image":{"id":34288037363811,"product_id":7848090730595,"position":2,"created_at":"2025-08-05T09:47:45+08:00","updated_at":"2025-08-05T09:47:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd769a6451581377a0b4f4e459de3f607f71f1d1.webp?v=1754358467","variant_ids":[43563015471203]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Selfie Time - 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-FV66","featured_media":{"alt":null,"id":25888968573027,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd769a6451581377a0b4f4e459de3f607f71f1d1.webp?v=1754358467"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3759902ed28c84d51ad6a6b24cea9ee2a48190a3.webp?v=1754358466","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd769a6451581377a0b4f4e459de3f607f71f1d1.webp?v=1754358467","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0f0785fab4b5fcdab5bb0d9045511cded7d60cae.webp?v=1754358468","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f173a191195a982c4d2d3439291ef10aa0adaa04.webp?v=1754358468","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/32ab68d43940f7c85a973938bceda51d65873269.webp?v=1754358469","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2720d03c8c1c270d34108a3af5876ea99524798e.webp?v=1754358469","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ecd50e95486a39c02dfb5db0c0906a0ee5ea85e6.webp?v=1754358470","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7256473ea666ff86d0bb1878342b5ee6c209f7cd.webp?v=1754358471","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/70f3d06fdcc90f09dc75059955b673a719e9d8d5.webp?v=1754358471","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26547c437550d4ced7e67a4d94ba1a7c868875d2.webp?v=1754358472","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89f8bdf9894184a00378d6a53b32eaf902e5ede6.webp?v=1754358472"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3759902ed28c84d51ad6a6b24cea9ee2a48190a3.webp?v=1754358466","options":["color"],"media":[{"alt":null,"id":25888968376419,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3759902ed28c84d51ad6a6b24cea9ee2a48190a3.webp?v=1754358466"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3759902ed28c84d51ad6a6b24cea9ee2a48190a3.webp?v=1754358466","width":2000},{"alt":null,"id":25888968573027,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd769a6451581377a0b4f4e459de3f607f71f1d1.webp?v=1754358467"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd769a6451581377a0b4f4e459de3f607f71f1d1.webp?v=1754358467","width":2000},{"alt":null,"id":25888968966243,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0f0785fab4b5fcdab5bb0d9045511cded7d60cae.webp?v=1754358468"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0f0785fab4b5fcdab5bb0d9045511cded7d60cae.webp?v=1754358468","width":2000},{"alt":null,"id":25888969031779,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f173a191195a982c4d2d3439291ef10aa0adaa04.webp?v=1754358468"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/f173a191195a982c4d2d3439291ef10aa0adaa04.webp?v=1754358468","width":2000},{"alt":null,"id":25888969162851,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/32ab68d43940f7c85a973938bceda51d65873269.webp?v=1754358469"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/32ab68d43940f7c85a973938bceda51d65873269.webp?v=1754358469","width":2000},{"alt":null,"id":25888969261155,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2720d03c8c1c270d34108a3af5876ea99524798e.webp?v=1754358469"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2720d03c8c1c270d34108a3af5876ea99524798e.webp?v=1754358469","width":2000},{"alt":null,"id":25888969424995,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ecd50e95486a39c02dfb5db0c0906a0ee5ea85e6.webp?v=1754358470"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ecd50e95486a39c02dfb5db0c0906a0ee5ea85e6.webp?v=1754358470","width":2000},{"alt":null,"id":25888969621603,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7256473ea666ff86d0bb1878342b5ee6c209f7cd.webp?v=1754358471"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7256473ea666ff86d0bb1878342b5ee6c209f7cd.webp?v=1754358471","width":2000},{"alt":null,"id":25888969785443,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/70f3d06fdcc90f09dc75059955b673a719e9d8d5.webp?v=1754358471"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/70f3d06fdcc90f09dc75059955b673a719e9d8d5.webp?v=1754358471","width":2000},{"alt":null,"id":25888969982051,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26547c437550d4ced7e67a4d94ba1a7c868875d2.webp?v=1754358472"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26547c437550d4ced7e67a4d94ba1a7c868875d2.webp?v=1754358472","width":2000},{"alt":null,"id":25888970080355,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89f8bdf9894184a00378d6a53b32eaf902e5ede6.webp?v=1754358472"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/89f8bdf9894184a00378d6a53b32eaf902e5ede6.webp?v=1754358472","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43563011473507,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-FV66","requires_shipping":true,"taxable":true,"featured_image":{"id":34288040050787,"product_id":7848090730595,"position":10,"created_at":"2025-08-05T09:47:49+08:00","updated_at":"2025-08-05T09:47:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26547c437550d4ced7e67a4d94ba1a7c868875d2.webp?v=1754358472","variant_ids":[43563011473507]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Selfie Time - 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-FV66","featured_media":{"alt":null,"id":25888969982051,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26547c437550d4ced7e67a4d94ba1a7c868875d2.webp?v=1754358472"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43563015209059,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-FV66","requires_shipping":true,"taxable":true,"featured_image":{"id":34288038412387,"product_id":7848090730595,"position":5,"created_at":"2025-08-05T09:47:47+08:00","updated_at":"2025-08-05T09:47:49+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/32ab68d43940f7c85a973938bceda51d65873269.webp?v=1754358469","variant_ids":[43563015209059]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Selfie Time - 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-FV66","featured_media":{"alt":null,"id":25888969162851,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/32ab68d43940f7c85a973938bceda51d65873269.webp?v=1754358469"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43563015274595,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-FV66","requires_shipping":true,"taxable":true,"featured_image":{"id":34288037789795,"product_id":7848090730595,"position":3,"created_at":"2025-08-05T09:47:46+08:00","updated_at":"2025-08-05T09:47:48+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0f0785fab4b5fcdab5bb0d9045511cded7d60cae.webp?v=1754358468","variant_ids":[43563015274595]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Selfie Time - 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-FV66","featured_media":{"alt":null,"id":25888968966243,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0f0785fab4b5fcdab5bb0d9045511cded7d60cae.webp?v=1754358468"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43563015372899,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-FV66","requires_shipping":true,"taxable":true,"featured_image":{"id":34288039329891,"product_id":7848090730595,"position":8,"created_at":"2025-08-05T09:47:48+08:00","updated_at":"2025-08-05T09:47:51+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7256473ea666ff86d0bb1878342b5ee6c209f7cd.webp?v=1754358471","variant_ids":[43563015372899]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Selfie Time - 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-FV66","featured_media":{"alt":null,"id":25888969621603,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7256473ea666ff86d0bb1878342b5ee6c209f7cd.webp?v=1754358471"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43563015471203,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-FV66","requires_shipping":true,"taxable":true,"featured_image":{"id":34288037363811,"product_id":7848090730595,"position":2,"created_at":"2025-08-05T09:47:45+08:00","updated_at":"2025-08-05T09:47:47+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd769a6451581377a0b4f4e459de3f607f71f1d1.webp?v=1754358467","variant_ids":[43563015471203]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Selfie Time - 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-FV66","featured_media":{"alt":null,"id":25888968573027,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cd769a6451581377a0b4f4e459de3f607f71f1d1.webp?v=1754358467"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43563011473507,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-FV66","requires_shipping":true,"taxable":true,"featured_image":{"id":34288040050787,"product_id":7848090730595,"position":10,"created_at":"2025-08-05T09:47:49+08:00","updated_at":"2025-08-05T09:47:52+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26547c437550d4ced7e67a4d94ba1a7c868875d2.webp?v=1754358472","variant_ids":[43563011473507]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Selfie Time - 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-FV66","featured_media":{"alt":null,"id":25888969982051,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26547c437550d4ced7e67a4d94ba1a7c868875d2.webp?v=1754358472"}},"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: "停產"
}