$product = {"id":7931219181667,"title":"iPhone 12 mini Mod NX 白白日記 By Darylhochi 眾裏尋他 (黑白)","handle":"iphone-12-mini-mod-nx-ei77","description":null,"published_at":"2025-11-28T11:12:53+08:00","created_at":"2025-11-28T09:21:38+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-darylhochi","device-iPhone 12 Mini","merge","reseller-darylhochi"],"price":90000,"price_min":90000,"price_max":90000,"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":43860640137315,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-EI77","requires_shipping":true,"taxable":true,"featured_image":{"id":34861484277859,"product_id":7931219181667,"position":22,"created_at":"2025-11-28T10:07:25+08:00","updated_at":"2025-11-28T10:07:27+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e8ae16a21f76b5ae593d6151fdfc5f1046063de_8541ae5d-56c3-4c62-b24f-89c46e153d0f.webp?v=1764295647","variant_ids":[43860640137315]},"available":true,"name":"iPhone 12 mini Mod NX 白白日記 By Darylhochi 眾裏尋他 (黑白) - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118424-EI77","featured_media":{"alt":null,"id":26425903808611,"position":22,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e8ae16a21f76b5ae593d6151fdfc5f1046063de_8541ae5d-56c3-4c62-b24f-89c46e153d0f.webp?v=1764295647"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/021b408cd3bbd2d6961ffbeddfe2c2a6b4ea9a2d.webp?v=1764292905","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0fab219b27d0f2a0aecbbcc809520b5d6d0dce98.webp?v=1764292905","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e8ae16a21f76b5ae593d6151fdfc5f1046063de.webp?v=1764292906","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/98e5608f02015e2d1db663169e77baf6f665ab7c.webp?v=1764292906","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69ce27132ac9f78b1a26e1c2f65a095c9aa80965.webp?v=1764292906","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c6c92b2da4b8de14578c19a6189d5e59d768ddf9.webp?v=1764292907","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2db8b974a743ce644942dcfeb975ca03f7e056c2.webp?v=1764292907","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/927489e36033873109d158c1edb3e7ad89c9ad77.webp?v=1764292908","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3dd09ecaa832e5d487226d72da28a981b3bc98b6.webp?v=1764292908","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8d1d6a3da7fe2eeafa868d551f15c971bc0dbaa8.webp?v=1764292909","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d93b24724c3d9fe1a210db1f574b89046d7146f8.webp?v=1764292909","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69ce27132ac9f78b1a26e1c2f65a095c9aa80965_8c55d570-b3d5-42a2-9a26-f74100f800a0.webp?v=1764295634","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8d1d6a3da7fe2eeafa868d551f15c971bc0dbaa8_67763313-41c9-4de9-bac6-fb414cc4e022.webp?v=1764295636","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d93b24724c3d9fe1a210db1f574b89046d7146f8_9e3c6492-21ac-4cd9-934b-0e566cd86da0.webp?v=1764295637","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2db8b974a743ce644942dcfeb975ca03f7e056c2_6ae80d99-eddc-447a-8997-50cff9ed2430.webp?v=1764295638","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/021b408cd3bbd2d6961ffbeddfe2c2a6b4ea9a2d_b86c808f-0ed7-47ab-8e77-9d89a683309b.webp?v=1764295638","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c6c92b2da4b8de14578c19a6189d5e59d768ddf9_803e91f0-a2be-48ca-aa83-fd70d87e8fcb.webp?v=1764295639","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/927489e36033873109d158c1edb3e7ad89c9ad77_562a833c-0f6e-488c-b0db-76f4d92156e6.webp?v=1764295640","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3dd09ecaa832e5d487226d72da28a981b3bc98b6_6d5d5bf8-c472-459c-b298-da0808f61b24.webp?v=1764295641","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0fab219b27d0f2a0aecbbcc809520b5d6d0dce98_2ecc6813-4798-48e3-8db4-78c9c62aae54.webp?v=1764295645","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/98e5608f02015e2d1db663169e77baf6f665ab7c_30f8dd6b-04a7-4b3a-87b7-fb052cbbd1aa.webp?v=1764295646","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e8ae16a21f76b5ae593d6151fdfc5f1046063de_8541ae5d-56c3-4c62-b24f-89c46e153d0f.webp?v=1764295647"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/021b408cd3bbd2d6961ffbeddfe2c2a6b4ea9a2d.webp?v=1764292905","options":["color"],"media":[{"alt":null,"id":26425568002147,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/021b408cd3bbd2d6961ffbeddfe2c2a6b4ea9a2d.webp?v=1764292905"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/021b408cd3bbd2d6961ffbeddfe2c2a6b4ea9a2d.webp?v=1764292905","width":2000},{"alt":null,"id":26425568264291,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0fab219b27d0f2a0aecbbcc809520b5d6d0dce98.webp?v=1764292905"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0fab219b27d0f2a0aecbbcc809520b5d6d0dce98.webp?v=1764292905","width":2000},{"alt":null,"id":26425568395363,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e8ae16a21f76b5ae593d6151fdfc5f1046063de.webp?v=1764292906"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e8ae16a21f76b5ae593d6151fdfc5f1046063de.webp?v=1764292906","width":2000},{"alt":null,"id":26425568591971,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/98e5608f02015e2d1db663169e77baf6f665ab7c.webp?v=1764292906"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/98e5608f02015e2d1db663169e77baf6f665ab7c.webp?v=1764292906","width":2000},{"alt":null,"id":26425568821347,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69ce27132ac9f78b1a26e1c2f65a095c9aa80965.webp?v=1764292906"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69ce27132ac9f78b1a26e1c2f65a095c9aa80965.webp?v=1764292906","width":2000},{"alt":null,"id":26425569050723,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c6c92b2da4b8de14578c19a6189d5e59d768ddf9.webp?v=1764292907"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c6c92b2da4b8de14578c19a6189d5e59d768ddf9.webp?v=1764292907","width":2000},{"alt":null,"id":26425569214563,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2db8b974a743ce644942dcfeb975ca03f7e056c2.webp?v=1764292907"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2db8b974a743ce644942dcfeb975ca03f7e056c2.webp?v=1764292907","width":2000},{"alt":null,"id":26425569476707,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/927489e36033873109d158c1edb3e7ad89c9ad77.webp?v=1764292908"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/927489e36033873109d158c1edb3e7ad89c9ad77.webp?v=1764292908","width":2000},{"alt":null,"id":26425569640547,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3dd09ecaa832e5d487226d72da28a981b3bc98b6.webp?v=1764292908"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3dd09ecaa832e5d487226d72da28a981b3bc98b6.webp?v=1764292908","width":2000},{"alt":null,"id":26425569837155,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8d1d6a3da7fe2eeafa868d551f15c971bc0dbaa8.webp?v=1764292909"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8d1d6a3da7fe2eeafa868d551f15c971bc0dbaa8.webp?v=1764292909","width":2000},{"alt":null,"id":26425570000995,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d93b24724c3d9fe1a210db1f574b89046d7146f8.webp?v=1764292909"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d93b24724c3d9fe1a210db1f574b89046d7146f8.webp?v=1764292909","width":2000},{"alt":null,"id":26425899319395,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69ce27132ac9f78b1a26e1c2f65a095c9aa80965_8c55d570-b3d5-42a2-9a26-f74100f800a0.webp?v=1764295634"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69ce27132ac9f78b1a26e1c2f65a095c9aa80965_8c55d570-b3d5-42a2-9a26-f74100f800a0.webp?v=1764295634","width":2000},{"alt":null,"id":26425899778147,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8d1d6a3da7fe2eeafa868d551f15c971bc0dbaa8_67763313-41c9-4de9-bac6-fb414cc4e022.webp?v=1764295636"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8d1d6a3da7fe2eeafa868d551f15c971bc0dbaa8_67763313-41c9-4de9-bac6-fb414cc4e022.webp?v=1764295636","width":2000},{"alt":null,"id":26425900269667,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d93b24724c3d9fe1a210db1f574b89046d7146f8_9e3c6492-21ac-4cd9-934b-0e566cd86da0.webp?v=1764295637"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d93b24724c3d9fe1a210db1f574b89046d7146f8_9e3c6492-21ac-4cd9-934b-0e566cd86da0.webp?v=1764295637","width":2000},{"alt":null,"id":26425900499043,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2db8b974a743ce644942dcfeb975ca03f7e056c2_6ae80d99-eddc-447a-8997-50cff9ed2430.webp?v=1764295638"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/2db8b974a743ce644942dcfeb975ca03f7e056c2_6ae80d99-eddc-447a-8997-50cff9ed2430.webp?v=1764295638","width":2000},{"alt":null,"id":26425900564579,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/021b408cd3bbd2d6961ffbeddfe2c2a6b4ea9a2d_b86c808f-0ed7-47ab-8e77-9d89a683309b.webp?v=1764295638"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/021b408cd3bbd2d6961ffbeddfe2c2a6b4ea9a2d_b86c808f-0ed7-47ab-8e77-9d89a683309b.webp?v=1764295638","width":2000},{"alt":null,"id":26425900761187,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c6c92b2da4b8de14578c19a6189d5e59d768ddf9_803e91f0-a2be-48ca-aa83-fd70d87e8fcb.webp?v=1764295639"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/c6c92b2da4b8de14578c19a6189d5e59d768ddf9_803e91f0-a2be-48ca-aa83-fd70d87e8fcb.webp?v=1764295639","width":2000},{"alt":null,"id":26425900957795,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/927489e36033873109d158c1edb3e7ad89c9ad77_562a833c-0f6e-488c-b0db-76f4d92156e6.webp?v=1764295640"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/927489e36033873109d158c1edb3e7ad89c9ad77_562a833c-0f6e-488c-b0db-76f4d92156e6.webp?v=1764295640","width":2000},{"alt":null,"id":26425901416547,"position":19,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3dd09ecaa832e5d487226d72da28a981b3bc98b6_6d5d5bf8-c472-459c-b298-da0808f61b24.webp?v=1764295641"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3dd09ecaa832e5d487226d72da28a981b3bc98b6_6d5d5bf8-c472-459c-b298-da0808f61b24.webp?v=1764295641","width":2000},{"alt":null,"id":26425902858339,"position":20,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0fab219b27d0f2a0aecbbcc809520b5d6d0dce98_2ecc6813-4798-48e3-8db4-78c9c62aae54.webp?v=1764295645"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/0fab219b27d0f2a0aecbbcc809520b5d6d0dce98_2ecc6813-4798-48e3-8db4-78c9c62aae54.webp?v=1764295645","width":2000},{"alt":null,"id":26425903317091,"position":21,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/98e5608f02015e2d1db663169e77baf6f665ab7c_30f8dd6b-04a7-4b3a-87b7-fb052cbbd1aa.webp?v=1764295646"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/98e5608f02015e2d1db663169e77baf6f665ab7c_30f8dd6b-04a7-4b3a-87b7-fb052cbbd1aa.webp?v=1764295646","width":2000},{"alt":null,"id":26425903808611,"position":22,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e8ae16a21f76b5ae593d6151fdfc5f1046063de_8541ae5d-56c3-4c62-b24f-89c46e153d0f.webp?v=1764295647"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e8ae16a21f76b5ae593d6151fdfc5f1046063de_8541ae5d-56c3-4c62-b24f-89c46e153d0f.webp?v=1764295647","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$bumper = null;
$variants = [{"id":43860640137315,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-EI77","requires_shipping":true,"taxable":true,"featured_image":{"id":34861484277859,"product_id":7931219181667,"position":22,"created_at":"2025-11-28T10:07:25+08:00","updated_at":"2025-11-28T10:07:27+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e8ae16a21f76b5ae593d6151fdfc5f1046063de_8541ae5d-56c3-4c62-b24f-89c46e153d0f.webp?v=1764295647","variant_ids":[43860640137315]},"available":true,"name":"iPhone 12 mini Mod NX 白白日記 By Darylhochi 眾裏尋他 (黑白) - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118424-EI77","featured_media":{"alt":null,"id":26425903808611,"position":22,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e8ae16a21f76b5ae593d6151fdfc5f1046063de_8541ae5d-56c3-4c62-b24f-89c46e153d0f.webp?v=1764295647"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43860640137315,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0118424-EI77","requires_shipping":true,"taxable":true,"featured_image":{"id":34861484277859,"product_id":7931219181667,"position":22,"created_at":"2025-11-28T10:07:25+08:00","updated_at":"2025-11-28T10:07:27+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e8ae16a21f76b5ae593d6151fdfc5f1046063de_8541ae5d-56c3-4c62-b24f-89c46e153d0f.webp?v=1764295647","variant_ids":[43860640137315]},"available":true,"name":"iPhone 12 mini Mod NX 白白日記 By Darylhochi 眾裏尋他 (黑白) - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0118424-EI77","featured_media":{"alt":null,"id":26425903808611,"position":22,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1e8ae16a21f76b5ae593d6151fdfc5f1046063de_8541ae5d-56c3-4c62-b24f-89c46e153d0f.webp?v=1764295647"}},"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: "停產"
}