$product = {"id":7848015855715,"title":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Wink Me","handle":"iphone-12-pro-mod-nx-magsafe-bumper-crossover-design-fv68","description":null,"published_at":"2025-08-07T09:24:47+08:00","created_at":"2025-08-05T09:34:53+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":43562764304483,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-FV68","requires_shipping":true,"taxable":true,"featured_image":{"id":34287614885987,"product_id":7848015855715,"position":11,"created_at":"2025-08-05T09:35:04+08:00","updated_at":"2025-08-05T09:35:06+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75078a3a79922b933f340582891ca361f8481c54.webp?v=1754357706","variant_ids":[43562764304483]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Wink Me - 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-FV68","featured_media":{"alt":null,"id":25888756432995,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75078a3a79922b933f340582891ca361f8481c54.webp?v=1754357706"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43562767908963,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-FV68","requires_shipping":true,"taxable":true,"featured_image":{"id":34287612330083,"product_id":7848015855715,"position":4,"created_at":"2025-08-05T09:34:59+08:00","updated_at":"2025-08-05T09:35:02+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d5f915d5d5679e08d9049a4661104d8752f065f4.webp?v=1754357702","variant_ids":[43562767908963]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Wink Me - 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-FV68","featured_media":{"alt":null,"id":25888755023971,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d5f915d5d5679e08d9049a4661104d8752f065f4.webp?v=1754357702"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43562767974499,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-FV68","requires_shipping":true,"taxable":true,"featured_image":{"id":34287612723299,"product_id":7848015855715,"position":5,"created_at":"2025-08-05T09:35:00+08:00","updated_at":"2025-08-05T09:35:02+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aa456d6cb4ebd0aa72d8789cb39632ea3dfa1983.webp?v=1754357702","variant_ids":[43562767974499]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Wink Me - 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-FV68","featured_media":{"alt":null,"id":25888755220579,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aa456d6cb4ebd0aa72d8789cb39632ea3dfa1983.webp?v=1754357702"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43562768072803,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-FV68","requires_shipping":true,"taxable":true,"featured_image":{"id":34287614525539,"product_id":7848015855715,"position":10,"created_at":"2025-08-05T09:35:03+08:00","updated_at":"2025-08-05T09:35:05+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e326d4f6889cfc92834e13a6127cedb9d7f3586.webp?v=1754357705","variant_ids":[43562768072803]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Wink Me - 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-FV68","featured_media":{"alt":null,"id":25888756236387,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e326d4f6889cfc92834e13a6127cedb9d7f3586.webp?v=1754357705"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43562768171107,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-FV68","requires_shipping":true,"taxable":true,"featured_image":{"id":34287611412579,"product_id":7848015855715,"position":2,"created_at":"2025-08-05T09:34:58+08:00","updated_at":"2025-08-05T09:35:00+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6be3f6015aad3268041b59e4e3dbbeaf701f6d7f.webp?v=1754357700","variant_ids":[43562768171107]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Wink Me - 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-FV68","featured_media":{"alt":null,"id":25888754663523,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6be3f6015aad3268041b59e4e3dbbeaf701f6d7f.webp?v=1754357700"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/663a9210cabac1d7923fd0eee35aa88f4524a093.webp?v=1754357699","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6be3f6015aad3268041b59e4e3dbbeaf701f6d7f.webp?v=1754357700","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0a222a07a07860bd416e95876c2fddc9ee534083.webp?v=1754357702","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d5f915d5d5679e08d9049a4661104d8752f065f4.webp?v=1754357702","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aa456d6cb4ebd0aa72d8789cb39632ea3dfa1983.webp?v=1754357702","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/976e5e0c4f1bafe31cf299b0022df0dc934537c9.webp?v=1754357703","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/06aaa6129b0b5c1a2e47aa1e814d591a40ad14e6.webp?v=1754357704","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de425e9247a30f9e7059039d108cfbce7000799c.webp?v=1754357704","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e86c99028d793b0a1a6c04cdad3b4bd1ecb9473b.webp?v=1754357705","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e326d4f6889cfc92834e13a6127cedb9d7f3586.webp?v=1754357705","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75078a3a79922b933f340582891ca361f8481c54.webp?v=1754357706"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/663a9210cabac1d7923fd0eee35aa88f4524a093.webp?v=1754357699","options":["color"],"media":[{"alt":null,"id":25888754172003,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/663a9210cabac1d7923fd0eee35aa88f4524a093.webp?v=1754357699"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/663a9210cabac1d7923fd0eee35aa88f4524a093.webp?v=1754357699","width":2000},{"alt":null,"id":25888754663523,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6be3f6015aad3268041b59e4e3dbbeaf701f6d7f.webp?v=1754357700"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6be3f6015aad3268041b59e4e3dbbeaf701f6d7f.webp?v=1754357700","width":2000},{"alt":null,"id":25888754860131,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0a222a07a07860bd416e95876c2fddc9ee534083.webp?v=1754357702"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0a222a07a07860bd416e95876c2fddc9ee534083.webp?v=1754357702","width":2000},{"alt":null,"id":25888755023971,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d5f915d5d5679e08d9049a4661104d8752f065f4.webp?v=1754357702"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d5f915d5d5679e08d9049a4661104d8752f065f4.webp?v=1754357702","width":2000},{"alt":null,"id":25888755220579,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aa456d6cb4ebd0aa72d8789cb39632ea3dfa1983.webp?v=1754357702"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aa456d6cb4ebd0aa72d8789cb39632ea3dfa1983.webp?v=1754357702","width":2000},{"alt":null,"id":25888755417187,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/976e5e0c4f1bafe31cf299b0022df0dc934537c9.webp?v=1754357703"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/976e5e0c4f1bafe31cf299b0022df0dc934537c9.webp?v=1754357703","width":2000},{"alt":null,"id":25888755613795,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/06aaa6129b0b5c1a2e47aa1e814d591a40ad14e6.webp?v=1754357704"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/06aaa6129b0b5c1a2e47aa1e814d591a40ad14e6.webp?v=1754357704","width":2000},{"alt":null,"id":25888755843171,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de425e9247a30f9e7059039d108cfbce7000799c.webp?v=1754357704"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/de425e9247a30f9e7059039d108cfbce7000799c.webp?v=1754357704","width":2000},{"alt":null,"id":25888755941475,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e86c99028d793b0a1a6c04cdad3b4bd1ecb9473b.webp?v=1754357705"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e86c99028d793b0a1a6c04cdad3b4bd1ecb9473b.webp?v=1754357705","width":2000},{"alt":null,"id":25888756236387,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e326d4f6889cfc92834e13a6127cedb9d7f3586.webp?v=1754357705"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e326d4f6889cfc92834e13a6127cedb9d7f3586.webp?v=1754357705","width":2000},{"alt":null,"id":25888756432995,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75078a3a79922b933f340582891ca361f8481c54.webp?v=1754357706"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75078a3a79922b933f340582891ca361f8481c54.webp?v=1754357706","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$bumper = null;
$variants = [{"id":43562764304483,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-FV68","requires_shipping":true,"taxable":true,"featured_image":{"id":34287614885987,"product_id":7848015855715,"position":11,"created_at":"2025-08-05T09:35:04+08:00","updated_at":"2025-08-05T09:35:06+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75078a3a79922b933f340582891ca361f8481c54.webp?v=1754357706","variant_ids":[43562764304483]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Wink Me - 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-FV68","featured_media":{"alt":null,"id":25888756432995,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75078a3a79922b933f340582891ca361f8481c54.webp?v=1754357706"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43562767908963,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-FV68","requires_shipping":true,"taxable":true,"featured_image":{"id":34287612330083,"product_id":7848015855715,"position":4,"created_at":"2025-08-05T09:34:59+08:00","updated_at":"2025-08-05T09:35:02+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d5f915d5d5679e08d9049a4661104d8752f065f4.webp?v=1754357702","variant_ids":[43562767908963]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Wink Me - 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-FV68","featured_media":{"alt":null,"id":25888755023971,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d5f915d5d5679e08d9049a4661104d8752f065f4.webp?v=1754357702"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43562767974499,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-FV68","requires_shipping":true,"taxable":true,"featured_image":{"id":34287612723299,"product_id":7848015855715,"position":5,"created_at":"2025-08-05T09:35:00+08:00","updated_at":"2025-08-05T09:35:02+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aa456d6cb4ebd0aa72d8789cb39632ea3dfa1983.webp?v=1754357702","variant_ids":[43562767974499]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Wink Me - 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-FV68","featured_media":{"alt":null,"id":25888755220579,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/aa456d6cb4ebd0aa72d8789cb39632ea3dfa1983.webp?v=1754357702"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43562768072803,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-FV68","requires_shipping":true,"taxable":true,"featured_image":{"id":34287614525539,"product_id":7848015855715,"position":10,"created_at":"2025-08-05T09:35:03+08:00","updated_at":"2025-08-05T09:35:05+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e326d4f6889cfc92834e13a6127cedb9d7f3586.webp?v=1754357705","variant_ids":[43562768072803]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Wink Me - 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-FV68","featured_media":{"alt":null,"id":25888756236387,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e326d4f6889cfc92834e13a6127cedb9d7f3586.webp?v=1754357705"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43562768171107,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-FV68","requires_shipping":true,"taxable":true,"featured_image":{"id":34287611412579,"product_id":7848015855715,"position":2,"created_at":"2025-08-05T09:34:58+08:00","updated_at":"2025-08-05T09:35:00+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6be3f6015aad3268041b59e4e3dbbeaf701f6d7f.webp?v=1754357700","variant_ids":[43562768171107]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Wink Me - 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-FV68","featured_media":{"alt":null,"id":25888754663523,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6be3f6015aad3268041b59e4e3dbbeaf701f6d7f.webp?v=1754357700"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43562764304483,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-FV68","requires_shipping":true,"taxable":true,"featured_image":{"id":34287614885987,"product_id":7848015855715,"position":11,"created_at":"2025-08-05T09:35:04+08:00","updated_at":"2025-08-05T09:35:06+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75078a3a79922b933f340582891ca361f8481c54.webp?v=1754357706","variant_ids":[43562764304483]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 嗨小強 Wink Me - 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-FV68","featured_media":{"alt":null,"id":25888756432995,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/75078a3a79922b933f340582891ca361f8481c54.webp?v=1754357706"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}};
$device_handle = null
var sellingStatus
if ($bumper) {
$(document).ready(function() {
var productImg = $product.images[0]
var bumperVariants = $bumper.variants;
var bumperColors = new Object();
var currentVariant = '';
var productType = '';
bumperVariants.forEach(variant => {
bumperColors[`${variant.title.split(' (')[0].toLowerCase()}`] = variant.featured_image.src;
});
if (productType === 'mod-nx-backplate' || productType === 'mod-backplate') {
mergeImages(
[productImg, bumperColors[currentVariant]],
{ crossOrigin: 'anonymous' }
).then(mergedImg => {
$('.merged-img').attr('src', mergedImg);
});
} else {
mergeImages(
[bumperColors[currentVariant], productImg],
{ crossOrigin: 'anonymous' }
).then(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: "停產"
}