$product = {"id":7769397526627,"title":"iPhone 14 Pro Mod NX ilovedoodle Lunar Mirage Cat - 月光貓","handle":"iphone-14-pro-mod-nx-printable-xf53","description":null,"published_at":"2025-07-16T17:40:23+08:00","created_at":"2025-04-15T15:29:51+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"設計師MOD NX專區-I Love Doodle","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-ilovedoodle","device-iPhone 14 Pro","merge","reseller-ilovedoodle"],"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":43302141100131,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0126224-XF53","requires_shipping":true,"taxable":true,"featured_image":{"id":34197424832611,"product_id":7769397526627,"position":9,"created_at":"2025-07-16T15:05:55+08:00","updated_at":"2025-07-16T15:05:57+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3122fe2a9db02dbfe25db8e3e4af48cbd22fcc9c_f36c9273-bf8a-47ee-bc0a-a59f9aa5dcec.webp?v=1752649557","variant_ids":[43302141100131]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Lunar Mirage Cat - 月光貓 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0126224-XF53","featured_media":{"alt":null,"id":25829890785379,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3122fe2a9db02dbfe25db8e3e4af48cbd22fcc9c_f36c9273-bf8a-47ee-bc0a-a59f9aa5dcec.webp?v=1752649557"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43302147653731,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0126204-XF53","requires_shipping":true,"taxable":true,"featured_image":{"id":34197422375011,"product_id":7769397526627,"position":2,"created_at":"2025-07-16T15:05:51+08:00","updated_at":"2025-07-16T15:05:53+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69f0d1f47eebb5e47e7ec424d47711aca8ba3779_40997267-67bc-49c9-8dc5-f3ef554258fd.webp?v=1752649553","variant_ids":[43302147653731]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Lunar Mirage Cat - 月光貓 - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0126204-XF53","featured_media":{"alt":null,"id":25829889704035,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69f0d1f47eebb5e47e7ec424d47711aca8ba3779_40997267-67bc-49c9-8dc5-f3ef554258fd.webp?v=1752649553"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43302147817571,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01262J5-XF53","requires_shipping":true,"taxable":true,"featured_image":{"id":34197423030371,"product_id":7769397526627,"position":4,"created_at":"2025-07-16T15:05:52+08:00","updated_at":"2025-07-16T15:05:54+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/511fb6a313fc2ea3bbf668b4e12d2d5bc42a6652_5578ac76-7830-4d55-b31e-11707c8e35b7.webp?v=1752649554","variant_ids":[43302147817571]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Lunar Mirage Cat - 月光貓 - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01262J5-XF53","featured_media":{"alt":null,"id":25829889998947,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/511fb6a313fc2ea3bbf668b4e12d2d5bc42a6652_5578ac76-7830-4d55-b31e-11707c8e35b7.webp?v=1752649554"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9805e0511ddd3f0555c9b06cfea2823258b77273.webp?v=1744702199","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69f0d1f47eebb5e47e7ec424d47711aca8ba3779_40997267-67bc-49c9-8dc5-f3ef554258fd.webp?v=1752649553","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/64f714264cbd583fe3f1fca7a6b50c4d3f9aee38_0fa11c70-2a40-458c-8fe0-5229425a183b.webp?v=1752649554","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/511fb6a313fc2ea3bbf668b4e12d2d5bc42a6652_5578ac76-7830-4d55-b31e-11707c8e35b7.webp?v=1752649554","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6a3f6c49bd92bb3c241115c597642dc32f65604c_04577951-43a8-4078-8b12-d36aa38ccf38.webp?v=1752649555","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/21345a8284ad5878885d2566d98b0316f3f6d263_721bd8a9-aeef-456f-bd94-e0923084bc40.webp?v=1752649555","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26bf281fa80832dea2a5269ebda1a17f8d6da8ff_bdec346f-7a15-49c6-a18e-63c88bd67126.webp?v=1752649556","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e44e559b3c1643025e41221f553ec3b1182fb097_6c2f3238-fd3d-4651-9234-c7b3303e4fc7.webp?v=1752649556","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3122fe2a9db02dbfe25db8e3e4af48cbd22fcc9c_f36c9273-bf8a-47ee-bc0a-a59f9aa5dcec.webp?v=1752649557","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5c4db4a703b457c5a6fb00abefda723e7a0df10_aae45720-4964-4ee1-977e-dfb3de48b955.webp?v=1752649557","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6806a1e16c7f6e6c077b17e0ff3f60ab890dd9fa_c434f26e-afab-4323-afcf-a811b4b64d30.webp?v=1752649558","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5ad5f1d24d91faf8c033026c3387ac4f775eb9a7_b6c53b1b-d460-4bda-9941-3b3491c19632.webp?v=1752649558","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e3df4755f690f4460a03c5fb408a254956ea7d11_bf29000f-33a2-4b7c-af5d-d1649e6b7e1b.webp?v=1752649559"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9805e0511ddd3f0555c9b06cfea2823258b77273.webp?v=1744702199","options":["color"],"media":[{"alt":null,"id":25495284547683,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9805e0511ddd3f0555c9b06cfea2823258b77273.webp?v=1744702199"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9805e0511ddd3f0555c9b06cfea2823258b77273.webp?v=1744702199","width":2000},{"alt":null,"id":25829889704035,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69f0d1f47eebb5e47e7ec424d47711aca8ba3779_40997267-67bc-49c9-8dc5-f3ef554258fd.webp?v=1752649553"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69f0d1f47eebb5e47e7ec424d47711aca8ba3779_40997267-67bc-49c9-8dc5-f3ef554258fd.webp?v=1752649553","width":2000},{"alt":null,"id":25829889802339,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/64f714264cbd583fe3f1fca7a6b50c4d3f9aee38_0fa11c70-2a40-458c-8fe0-5229425a183b.webp?v=1752649554"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/64f714264cbd583fe3f1fca7a6b50c4d3f9aee38_0fa11c70-2a40-458c-8fe0-5229425a183b.webp?v=1752649554","width":2000},{"alt":null,"id":25829889998947,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/511fb6a313fc2ea3bbf668b4e12d2d5bc42a6652_5578ac76-7830-4d55-b31e-11707c8e35b7.webp?v=1752649554"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/511fb6a313fc2ea3bbf668b4e12d2d5bc42a6652_5578ac76-7830-4d55-b31e-11707c8e35b7.webp?v=1752649554","width":2000},{"alt":null,"id":25829890097251,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6a3f6c49bd92bb3c241115c597642dc32f65604c_04577951-43a8-4078-8b12-d36aa38ccf38.webp?v=1752649555"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6a3f6c49bd92bb3c241115c597642dc32f65604c_04577951-43a8-4078-8b12-d36aa38ccf38.webp?v=1752649555","width":2000},{"alt":null,"id":25829890261091,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/21345a8284ad5878885d2566d98b0316f3f6d263_721bd8a9-aeef-456f-bd94-e0923084bc40.webp?v=1752649555"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/21345a8284ad5878885d2566d98b0316f3f6d263_721bd8a9-aeef-456f-bd94-e0923084bc40.webp?v=1752649555","width":2000},{"alt":null,"id":25829890490467,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26bf281fa80832dea2a5269ebda1a17f8d6da8ff_bdec346f-7a15-49c6-a18e-63c88bd67126.webp?v=1752649556"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/26bf281fa80832dea2a5269ebda1a17f8d6da8ff_bdec346f-7a15-49c6-a18e-63c88bd67126.webp?v=1752649556","width":2000},{"alt":null,"id":25829890654307,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e44e559b3c1643025e41221f553ec3b1182fb097_6c2f3238-fd3d-4651-9234-c7b3303e4fc7.webp?v=1752649556"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e44e559b3c1643025e41221f553ec3b1182fb097_6c2f3238-fd3d-4651-9234-c7b3303e4fc7.webp?v=1752649556","width":2000},{"alt":null,"id":25829890785379,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3122fe2a9db02dbfe25db8e3e4af48cbd22fcc9c_f36c9273-bf8a-47ee-bc0a-a59f9aa5dcec.webp?v=1752649557"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3122fe2a9db02dbfe25db8e3e4af48cbd22fcc9c_f36c9273-bf8a-47ee-bc0a-a59f9aa5dcec.webp?v=1752649557","width":2000},{"alt":null,"id":25829891014755,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5c4db4a703b457c5a6fb00abefda723e7a0df10_aae45720-4964-4ee1-977e-dfb3de48b955.webp?v=1752649557"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/b5c4db4a703b457c5a6fb00abefda723e7a0df10_aae45720-4964-4ee1-977e-dfb3de48b955.webp?v=1752649557","width":2000},{"alt":null,"id":25829891276899,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6806a1e16c7f6e6c077b17e0ff3f60ab890dd9fa_c434f26e-afab-4323-afcf-a811b4b64d30.webp?v=1752649558"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/6806a1e16c7f6e6c077b17e0ff3f60ab890dd9fa_c434f26e-afab-4323-afcf-a811b4b64d30.webp?v=1752649558","width":2000},{"alt":null,"id":25829891407971,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5ad5f1d24d91faf8c033026c3387ac4f775eb9a7_b6c53b1b-d460-4bda-9941-3b3491c19632.webp?v=1752649558"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5ad5f1d24d91faf8c033026c3387ac4f775eb9a7_b6c53b1b-d460-4bda-9941-3b3491c19632.webp?v=1752649558","width":2000},{"alt":null,"id":25829891604579,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e3df4755f690f4460a03c5fb408a254956ea7d11_bf29000f-33a2-4b7c-af5d-d1649e6b7e1b.webp?v=1752649559"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e3df4755f690f4460a03c5fb408a254956ea7d11_bf29000f-33a2-4b7c-af5d-d1649e6b7e1b.webp?v=1752649559","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43302141100131,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0126224-XF53","requires_shipping":true,"taxable":true,"featured_image":{"id":34197424832611,"product_id":7769397526627,"position":9,"created_at":"2025-07-16T15:05:55+08:00","updated_at":"2025-07-16T15:05:57+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3122fe2a9db02dbfe25db8e3e4af48cbd22fcc9c_f36c9273-bf8a-47ee-bc0a-a59f9aa5dcec.webp?v=1752649557","variant_ids":[43302141100131]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Lunar Mirage Cat - 月光貓 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0126224-XF53","featured_media":{"alt":null,"id":25829890785379,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3122fe2a9db02dbfe25db8e3e4af48cbd22fcc9c_f36c9273-bf8a-47ee-bc0a-a59f9aa5dcec.webp?v=1752649557"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43302147653731,"title":"White","option1":"White","option2":null,"option3":null,"sku":"NPB0126204-XF53","requires_shipping":true,"taxable":true,"featured_image":{"id":34197422375011,"product_id":7769397526627,"position":2,"created_at":"2025-07-16T15:05:51+08:00","updated_at":"2025-07-16T15:05:53+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69f0d1f47eebb5e47e7ec424d47711aca8ba3779_40997267-67bc-49c9-8dc5-f3ef554258fd.webp?v=1752649553","variant_ids":[43302147653731]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Lunar Mirage Cat - 月光貓 - White","public_title":"White","options":["White"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0126204-XF53","featured_media":{"alt":null,"id":25829889704035,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/69f0d1f47eebb5e47e7ec424d47711aca8ba3779_40997267-67bc-49c9-8dc5-f3ef554258fd.webp?v=1752649553"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43302147817571,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"NPB01262J5-XF53","requires_shipping":true,"taxable":true,"featured_image":{"id":34197423030371,"product_id":7769397526627,"position":4,"created_at":"2025-07-16T15:05:52+08:00","updated_at":"2025-07-16T15:05:54+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/511fb6a313fc2ea3bbf668b4e12d2d5bc42a6652_5578ac76-7830-4d55-b31e-11707c8e35b7.webp?v=1752649554","variant_ids":[43302147817571]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Lunar Mirage Cat - 月光貓 - Navy Blue","public_title":"Navy Blue","options":["Navy Blue"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB01262J5-XF53","featured_media":{"alt":null,"id":25829889998947,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/511fb6a313fc2ea3bbf668b4e12d2d5bc42a6652_5578ac76-7830-4d55-b31e-11707c8e35b7.webp?v=1752649554"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43302141100131,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0126224-XF53","requires_shipping":true,"taxable":true,"featured_image":{"id":34197424832611,"product_id":7769397526627,"position":9,"created_at":"2025-07-16T15:05:55+08:00","updated_at":"2025-07-16T15:05:57+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3122fe2a9db02dbfe25db8e3e4af48cbd22fcc9c_f36c9273-bf8a-47ee-bc0a-a59f9aa5dcec.webp?v=1752649557","variant_ids":[43302141100131]},"available":true,"name":"iPhone 14 Pro Mod NX ilovedoodle Lunar Mirage Cat - 月光貓 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0126224-XF53","featured_media":{"alt":null,"id":25829890785379,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3122fe2a9db02dbfe25db8e3e4af48cbd22fcc9c_f36c9273-bf8a-47ee-bc0a-a59f9aa5dcec.webp?v=1752649557"}},"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: "停產"
}