$product = {"id":7815656243299,"title":"iPhone XS Max Mod NX 小玉米花 新年恐龍","handle":"iphone-xs-max-mod-nx-bumper-crossover-design-eg10","description":null,"published_at":"2025-06-11T15:10:53+08:00","created_at":"2025-06-11T14:32:52+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-littlepopcorn","device-iPhone XS Max","merge","reseller-littlepopcorn"],"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":43444983431267,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0108624-EG10","requires_shipping":true,"taxable":true,"featured_image":{"id":34012393603171,"product_id":7815656243299,"position":19,"created_at":"2025-06-12T10:10:51+08:00","updated_at":"2025-06-12T10:10:53+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b866c14f9b7940e93cde6c28276ff3234dc08f_0f0fe0c8-a7ea-4114-b819-ccb8d1e87d9c.webp?v=1749694253","variant_ids":[43444983431267]},"available":true,"name":"iPhone XS Max Mod NX 小玉米花 新年恐龍 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108624-EG10","featured_media":{"alt":null,"id":25692921397347,"position":19,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b866c14f9b7940e93cde6c28276ff3234dc08f_0f0fe0c8-a7ea-4114-b819-ccb8d1e87d9c.webp?v=1749694253"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/993bd21867672b0e982e0abd9276a157801e94c1.webp?v=1749623577","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b866c14f9b7940e93cde6c28276ff3234dc08f.webp?v=1749623577","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eac0b195e7f32002e3905e5d9227654f3d84c0c8.webp?v=1749623578","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cbd1252b2c7c56f625d8ad9eb4044c697e46db95.webp?v=1749623579","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/915e41042e89a4e0a73a5f4b0dd2d7e3559737b7.webp?v=1749623580","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e00e1952eed5dae2affd172cd3963233762145e1.webp?v=1749623580","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a2c24624599e32b60d20821fe1857c2d5dab0b79.webp?v=1749623581","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eac0b195e7f32002e3905e5d9227654f3d84c0c8_74c11732-fa37-4c59-b5ed-6dcf84fa36a3.webp?v=1749625597","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a2c24624599e32b60d20821fe1857c2d5dab0b79_1884d595-8e29-414d-ae8a-b6921e71d862.webp?v=1749625598","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e00e1952eed5dae2affd172cd3963233762145e1_43cc53e8-0edd-4d19-8213-cf3eb8c64eab.webp?v=1749625598","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cbd1252b2c7c56f625d8ad9eb4044c697e46db95_a30445d3-3bd9-4828-9324-d73c7c9b4d8d.webp?v=1749625599","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/915e41042e89a4e0a73a5f4b0dd2d7e3559737b7_30538ac0-d804-468d-8036-a0ad747549d5.webp?v=1749625599","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b866c14f9b7940e93cde6c28276ff3234dc08f_0bd80f7d-169b-4dcc-be49-6ea09e9b7779.webp?v=1749625601","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/993bd21867672b0e982e0abd9276a157801e94c1_cec749e2-bcf1-4cae-aea1-abe6e8eeb043.webp?v=1749625601","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cbd1252b2c7c56f625d8ad9eb4044c697e46db95_a69d5636-b353-4c3d-8117-eb603f832694.webp?v=1749694250","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eac0b195e7f32002e3905e5d9227654f3d84c0c8_7e75516a-01da-46d4-9f5a-d6e2b26d547d.webp?v=1749694251","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/915e41042e89a4e0a73a5f4b0dd2d7e3559737b7_d7571e60-baa1-46d3-ae20-2afd00fda9f6.webp?v=1749694252","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/993bd21867672b0e982e0abd9276a157801e94c1_660239fc-ed6e-4ff9-85a2-26f031994841.webp?v=1749694252","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b866c14f9b7940e93cde6c28276ff3234dc08f_0f0fe0c8-a7ea-4114-b819-ccb8d1e87d9c.webp?v=1749694253","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e00e1952eed5dae2affd172cd3963233762145e1_b4d0adf3-2ff8-4544-88e9-c4e48eac3114.webp?v=1749694253","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a2c24624599e32b60d20821fe1857c2d5dab0b79_83c0a6dd-5444-4ce0-a9a7-2aa315f88c58.webp?v=1749694254"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/993bd21867672b0e982e0abd9276a157801e94c1.webp?v=1749623577","options":["color"],"media":[{"alt":null,"id":25689654001763,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/993bd21867672b0e982e0abd9276a157801e94c1.webp?v=1749623577"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/993bd21867672b0e982e0abd9276a157801e94c1.webp?v=1749623577","width":2000},{"alt":null,"id":25689654132835,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b866c14f9b7940e93cde6c28276ff3234dc08f.webp?v=1749623577"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b866c14f9b7940e93cde6c28276ff3234dc08f.webp?v=1749623577","width":2000},{"alt":null,"id":25689654231139,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eac0b195e7f32002e3905e5d9227654f3d84c0c8.webp?v=1749623578"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eac0b195e7f32002e3905e5d9227654f3d84c0c8.webp?v=1749623578","width":2000},{"alt":null,"id":25689654460515,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cbd1252b2c7c56f625d8ad9eb4044c697e46db95.webp?v=1749623579"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cbd1252b2c7c56f625d8ad9eb4044c697e46db95.webp?v=1749623579","width":2000},{"alt":null,"id":25689654788195,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/915e41042e89a4e0a73a5f4b0dd2d7e3559737b7.webp?v=1749623580"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/915e41042e89a4e0a73a5f4b0dd2d7e3559737b7.webp?v=1749623580","width":2000},{"alt":null,"id":25689654984803,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e00e1952eed5dae2affd172cd3963233762145e1.webp?v=1749623580"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e00e1952eed5dae2affd172cd3963233762145e1.webp?v=1749623580","width":2000},{"alt":null,"id":25689655345251,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a2c24624599e32b60d20821fe1857c2d5dab0b79.webp?v=1749623581"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a2c24624599e32b60d20821fe1857c2d5dab0b79.webp?v=1749623581","width":2000},{"alt":null,"id":25690039189603,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eac0b195e7f32002e3905e5d9227654f3d84c0c8_74c11732-fa37-4c59-b5ed-6dcf84fa36a3.webp?v=1749625597"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eac0b195e7f32002e3905e5d9227654f3d84c0c8_74c11732-fa37-4c59-b5ed-6dcf84fa36a3.webp?v=1749625597","width":2000},{"alt":null,"id":25690039386211,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a2c24624599e32b60d20821fe1857c2d5dab0b79_1884d595-8e29-414d-ae8a-b6921e71d862.webp?v=1749625598"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a2c24624599e32b60d20821fe1857c2d5dab0b79_1884d595-8e29-414d-ae8a-b6921e71d862.webp?v=1749625598","width":2000},{"alt":null,"id":25690039681123,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e00e1952eed5dae2affd172cd3963233762145e1_43cc53e8-0edd-4d19-8213-cf3eb8c64eab.webp?v=1749625598"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e00e1952eed5dae2affd172cd3963233762145e1_43cc53e8-0edd-4d19-8213-cf3eb8c64eab.webp?v=1749625598","width":2000},{"alt":null,"id":25690040008803,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cbd1252b2c7c56f625d8ad9eb4044c697e46db95_a30445d3-3bd9-4828-9324-d73c7c9b4d8d.webp?v=1749625599"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cbd1252b2c7c56f625d8ad9eb4044c697e46db95_a30445d3-3bd9-4828-9324-d73c7c9b4d8d.webp?v=1749625599","width":2000},{"alt":null,"id":25690040238179,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/915e41042e89a4e0a73a5f4b0dd2d7e3559737b7_30538ac0-d804-468d-8036-a0ad747549d5.webp?v=1749625599"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/915e41042e89a4e0a73a5f4b0dd2d7e3559737b7_30538ac0-d804-468d-8036-a0ad747549d5.webp?v=1749625599","width":2000},{"alt":null,"id":25690040729699,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b866c14f9b7940e93cde6c28276ff3234dc08f_0bd80f7d-169b-4dcc-be49-6ea09e9b7779.webp?v=1749625601"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b866c14f9b7940e93cde6c28276ff3234dc08f_0bd80f7d-169b-4dcc-be49-6ea09e9b7779.webp?v=1749625601","width":2000},{"alt":null,"id":25690040926307,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/993bd21867672b0e982e0abd9276a157801e94c1_cec749e2-bcf1-4cae-aea1-abe6e8eeb043.webp?v=1749625601"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/993bd21867672b0e982e0abd9276a157801e94c1_cec749e2-bcf1-4cae-aea1-abe6e8eeb043.webp?v=1749625601","width":2000},{"alt":null,"id":25692920676451,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cbd1252b2c7c56f625d8ad9eb4044c697e46db95_a69d5636-b353-4c3d-8117-eb603f832694.webp?v=1749694250"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/cbd1252b2c7c56f625d8ad9eb4044c697e46db95_a69d5636-b353-4c3d-8117-eb603f832694.webp?v=1749694250","width":2000},{"alt":null,"id":25692920938595,"position":16,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eac0b195e7f32002e3905e5d9227654f3d84c0c8_7e75516a-01da-46d4-9f5a-d6e2b26d547d.webp?v=1749694251"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/eac0b195e7f32002e3905e5d9227654f3d84c0c8_7e75516a-01da-46d4-9f5a-d6e2b26d547d.webp?v=1749694251","width":2000},{"alt":null,"id":25692921135203,"position":17,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/915e41042e89a4e0a73a5f4b0dd2d7e3559737b7_d7571e60-baa1-46d3-ae20-2afd00fda9f6.webp?v=1749694252"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/915e41042e89a4e0a73a5f4b0dd2d7e3559737b7_d7571e60-baa1-46d3-ae20-2afd00fda9f6.webp?v=1749694252","width":2000},{"alt":null,"id":25692921266275,"position":18,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/993bd21867672b0e982e0abd9276a157801e94c1_660239fc-ed6e-4ff9-85a2-26f031994841.webp?v=1749694252"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/993bd21867672b0e982e0abd9276a157801e94c1_660239fc-ed6e-4ff9-85a2-26f031994841.webp?v=1749694252","width":2000},{"alt":null,"id":25692921397347,"position":19,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b866c14f9b7940e93cde6c28276ff3234dc08f_0f0fe0c8-a7ea-4114-b819-ccb8d1e87d9c.webp?v=1749694253"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b866c14f9b7940e93cde6c28276ff3234dc08f_0f0fe0c8-a7ea-4114-b819-ccb8d1e87d9c.webp?v=1749694253","width":2000},{"alt":null,"id":25692921430115,"position":20,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e00e1952eed5dae2affd172cd3963233762145e1_b4d0adf3-2ff8-4544-88e9-c4e48eac3114.webp?v=1749694253"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e00e1952eed5dae2affd172cd3963233762145e1_b4d0adf3-2ff8-4544-88e9-c4e48eac3114.webp?v=1749694253","width":2000},{"alt":null,"id":25692921528419,"position":21,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a2c24624599e32b60d20821fe1857c2d5dab0b79_83c0a6dd-5444-4ce0-a9a7-2aa315f88c58.webp?v=1749694254"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a2c24624599e32b60d20821fe1857c2d5dab0b79_83c0a6dd-5444-4ce0-a9a7-2aa315f88c58.webp?v=1749694254","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43444983431267,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0108624-EG10","requires_shipping":true,"taxable":true,"featured_image":{"id":34012393603171,"product_id":7815656243299,"position":19,"created_at":"2025-06-12T10:10:51+08:00","updated_at":"2025-06-12T10:10:53+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b866c14f9b7940e93cde6c28276ff3234dc08f_0f0fe0c8-a7ea-4114-b819-ccb8d1e87d9c.webp?v=1749694253","variant_ids":[43444983431267]},"available":true,"name":"iPhone XS Max Mod NX 小玉米花 新年恐龍 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108624-EG10","featured_media":{"alt":null,"id":25692921397347,"position":19,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b866c14f9b7940e93cde6c28276ff3234dc08f_0f0fe0c8-a7ea-4114-b819-ccb8d1e87d9c.webp?v=1749694253"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43444983431267,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"NPB0108624-EG10","requires_shipping":true,"taxable":true,"featured_image":{"id":34012393603171,"product_id":7815656243299,"position":19,"created_at":"2025-06-12T10:10:51+08:00","updated_at":"2025-06-12T10:10:53+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b866c14f9b7940e93cde6c28276ff3234dc08f_0f0fe0c8-a7ea-4114-b819-ccb8d1e87d9c.webp?v=1749694253","variant_ids":[43444983431267]},"available":true,"name":"iPhone XS Max Mod NX 小玉米花 新年恐龍 - Black","public_title":"Black","options":["Black"],"price":90000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"NPB0108624-EG10","featured_media":{"alt":null,"id":25692921397347,"position":19,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/04b866c14f9b7940e93cde6c28276ff3234dc08f_0f0fe0c8-a7ea-4114-b819-ccb8d1e87d9c.webp?v=1749694253"}},"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: "停產"
}