$product = {"id":7956202455139,"title":"iPhone 12 mini SolidSuit Emerald Studio 夏","handle":"iphone-12-mini-solidsuit-classic-eme11","description":null,"published_at":"2026-01-28T09:43:55+08:00","created_at":"2026-01-26T14:37:25+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-emerald","device-iPhone 12 Mini","merge","reseller-emerald"],"price":83000,"price_min":83000,"price_max":83000,"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":43966953390179,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"SST011840B-EME11","requires_shipping":true,"taxable":true,"featured_image":{"id":36359109607523,"product_id":7956202455139,"position":13,"created_at":"2026-07-23T14:31:22+08:00","updated_at":"2026-07-23T14:31:24+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f5d772859142c71d21a1d0c8e315b33c12aba38_483eee55-fb60-4c03-a201-bc84d3205e48.webp?v=1784788284","variant_ids":[43966953390179]},"available":true,"name":"iPhone 12 mini SolidSuit Emerald Studio 夏 - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST011840B-EME11","featured_media":{"alt":null,"id":27862892183651,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f5d772859142c71d21a1d0c8e315b33c12aba38_483eee55-fb60-4c03-a201-bc84d3205e48.webp?v=1784788284"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966955389027,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"SST01184O9-EME11","requires_shipping":true,"taxable":true,"featured_image":{"id":36359109083235,"product_id":7956202455139,"position":12,"created_at":"2026-07-23T14:31:21+08:00","updated_at":"2026-07-23T14:31:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fa5d262d336f7bc0141907300896bff72edfad9_216da197-687d-4f67-ad9b-e3b84b4d3536.webp?v=1784788283","variant_ids":[43966955389027]},"available":true,"name":"iPhone 12 mini SolidSuit Emerald Studio 夏 - Cobalt Blue","public_title":"Cobalt Blue","options":["Cobalt Blue"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST01184O9-EME11","featured_media":{"alt":null,"id":27862891626595,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fa5d262d336f7bc0141907300896bff72edfad9_216da197-687d-4f67-ad9b-e3b84b4d3536.webp?v=1784788283"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966956044387,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"SST0118452-EME11","requires_shipping":true,"taxable":true,"featured_image":{"id":36359107870819,"product_id":7956202455139,"position":10,"created_at":"2026-07-23T14:31:20+08:00","updated_at":"2026-07-23T14:31:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/278a99c64e6d40d45cda791fbb07fb9c32af89af_8cdbb6e3-f4cb-4af8-a9c0-d9f55c092aaf.webp?v=1784788282","variant_ids":[43966956044387]},"available":true,"name":"iPhone 12 mini SolidSuit Emerald Studio 夏 - Black","public_title":"Black","options":["Black"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST0118452-EME11","featured_media":{"alt":null,"id":27862890446947,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/278a99c64e6d40d45cda791fbb07fb9c32af89af_8cdbb6e3-f4cb-4af8-a9c0-d9f55c092aaf.webp?v=1784788282"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fa5d262d336f7bc0141907300896bff72edfad9.webp?v=1769409482","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f5d772859142c71d21a1d0c8e315b33c12aba38.webp?v=1769409482","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/763a7cdedd8282777a92d779da0092f8a24837b9.webp?v=1769409482","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/278a99c64e6d40d45cda791fbb07fb9c32af89af.webp?v=1769409483","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/37e1456ccce9873f05282adb2cdafb381b2875f8.webp?v=1769409484","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c9fc4b5befd4acccdaae9d2ab664a15f5259374.webp?v=1769409484","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b2117eb0599f956272854439e2439d3aea27a39.webp?v=1769409484","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d01af1163df0e36529908e7e367f4dded9f14cd3.webp?v=1769409485","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ff0ae1da425ffc567ca3629de297dc41c54f5ca2.webp?v=1769409486","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/278a99c64e6d40d45cda791fbb07fb9c32af89af_8cdbb6e3-f4cb-4af8-a9c0-d9f55c092aaf.webp?v=1784788282","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/763a7cdedd8282777a92d779da0092f8a24837b9_58b1b56b-1503-4666-9bf9-a387d116a67a.webp?v=1784788283","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fa5d262d336f7bc0141907300896bff72edfad9_216da197-687d-4f67-ad9b-e3b84b4d3536.webp?v=1784788283","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f5d772859142c71d21a1d0c8e315b33c12aba38_483eee55-fb60-4c03-a201-bc84d3205e48.webp?v=1784788284","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c9fc4b5befd4acccdaae9d2ab664a15f5259374_89faf8f8-c737-40de-a19b-b5ecf19d3f8a.webp?v=1784788284","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/37e1456ccce9873f05282adb2cdafb381b2875f8_b339cbc3-def2-46c5-a2ec-45b6c1f9e782.webp?v=1784788285"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fa5d262d336f7bc0141907300896bff72edfad9.webp?v=1769409482","options":["color"],"media":[{"alt":null,"id":26703393357923,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fa5d262d336f7bc0141907300896bff72edfad9.webp?v=1769409482"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fa5d262d336f7bc0141907300896bff72edfad9.webp?v=1769409482","width":2000},{"alt":null,"id":26703394898019,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f5d772859142c71d21a1d0c8e315b33c12aba38.webp?v=1769409482"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f5d772859142c71d21a1d0c8e315b33c12aba38.webp?v=1769409482","width":2000},{"alt":null,"id":26703395356771,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/763a7cdedd8282777a92d779da0092f8a24837b9.webp?v=1769409482"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/763a7cdedd8282777a92d779da0092f8a24837b9.webp?v=1769409482","width":2000},{"alt":null,"id":26703396044899,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/278a99c64e6d40d45cda791fbb07fb9c32af89af.webp?v=1769409483"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/278a99c64e6d40d45cda791fbb07fb9c32af89af.webp?v=1769409483","width":2000},{"alt":null,"id":26703396700259,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/37e1456ccce9873f05282adb2cdafb381b2875f8.webp?v=1769409484"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/37e1456ccce9873f05282adb2cdafb381b2875f8.webp?v=1769409484","width":2000},{"alt":null,"id":26703397519459,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c9fc4b5befd4acccdaae9d2ab664a15f5259374.webp?v=1769409484"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c9fc4b5befd4acccdaae9d2ab664a15f5259374.webp?v=1769409484","width":2000},{"alt":null,"id":26703398338659,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b2117eb0599f956272854439e2439d3aea27a39.webp?v=1769409484"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/7b2117eb0599f956272854439e2439d3aea27a39.webp?v=1769409484","width":2000},{"alt":null,"id":26703399125091,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d01af1163df0e36529908e7e367f4dded9f14cd3.webp?v=1769409485"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d01af1163df0e36529908e7e367f4dded9f14cd3.webp?v=1769409485","width":2000},{"alt":null,"id":26703400271971,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ff0ae1da425ffc567ca3629de297dc41c54f5ca2.webp?v=1769409486"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ff0ae1da425ffc567ca3629de297dc41c54f5ca2.webp?v=1769409486","width":2000},{"alt":null,"id":27862890446947,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/278a99c64e6d40d45cda791fbb07fb9c32af89af_8cdbb6e3-f4cb-4af8-a9c0-d9f55c092aaf.webp?v=1784788282"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/278a99c64e6d40d45cda791fbb07fb9c32af89af_8cdbb6e3-f4cb-4af8-a9c0-d9f55c092aaf.webp?v=1784788282","width":2000},{"alt":null,"id":27862890774627,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/763a7cdedd8282777a92d779da0092f8a24837b9_58b1b56b-1503-4666-9bf9-a387d116a67a.webp?v=1784788283"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/763a7cdedd8282777a92d779da0092f8a24837b9_58b1b56b-1503-4666-9bf9-a387d116a67a.webp?v=1784788283","width":2000},{"alt":null,"id":27862891626595,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fa5d262d336f7bc0141907300896bff72edfad9_216da197-687d-4f67-ad9b-e3b84b4d3536.webp?v=1784788283"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fa5d262d336f7bc0141907300896bff72edfad9_216da197-687d-4f67-ad9b-e3b84b4d3536.webp?v=1784788283","width":2000},{"alt":null,"id":27862892183651,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f5d772859142c71d21a1d0c8e315b33c12aba38_483eee55-fb60-4c03-a201-bc84d3205e48.webp?v=1784788284"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f5d772859142c71d21a1d0c8e315b33c12aba38_483eee55-fb60-4c03-a201-bc84d3205e48.webp?v=1784788284","width":2000},{"alt":null,"id":27862892707939,"position":14,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c9fc4b5befd4acccdaae9d2ab664a15f5259374_89faf8f8-c737-40de-a19b-b5ecf19d3f8a.webp?v=1784788284"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3c9fc4b5befd4acccdaae9d2ab664a15f5259374_89faf8f8-c737-40de-a19b-b5ecf19d3f8a.webp?v=1784788284","width":2000},{"alt":null,"id":27862893461603,"position":15,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/37e1456ccce9873f05282adb2cdafb381b2875f8_b339cbc3-def2-46c5-a2ec-45b6c1f9e782.webp?v=1784788285"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/37e1456ccce9873f05282adb2cdafb381b2875f8_b339cbc3-def2-46c5-a2ec-45b6c1f9e782.webp?v=1784788285","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43966953390179,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"SST011840B-EME11","requires_shipping":true,"taxable":true,"featured_image":{"id":36359109607523,"product_id":7956202455139,"position":13,"created_at":"2026-07-23T14:31:22+08:00","updated_at":"2026-07-23T14:31:24+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f5d772859142c71d21a1d0c8e315b33c12aba38_483eee55-fb60-4c03-a201-bc84d3205e48.webp?v=1784788284","variant_ids":[43966953390179]},"available":true,"name":"iPhone 12 mini SolidSuit Emerald Studio 夏 - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST011840B-EME11","featured_media":{"alt":null,"id":27862892183651,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f5d772859142c71d21a1d0c8e315b33c12aba38_483eee55-fb60-4c03-a201-bc84d3205e48.webp?v=1784788284"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966955389027,"title":"Cobalt Blue","option1":"Cobalt Blue","option2":null,"option3":null,"sku":"SST01184O9-EME11","requires_shipping":true,"taxable":true,"featured_image":{"id":36359109083235,"product_id":7956202455139,"position":12,"created_at":"2026-07-23T14:31:21+08:00","updated_at":"2026-07-23T14:31:23+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fa5d262d336f7bc0141907300896bff72edfad9_216da197-687d-4f67-ad9b-e3b84b4d3536.webp?v=1784788283","variant_ids":[43966955389027]},"available":true,"name":"iPhone 12 mini SolidSuit Emerald Studio 夏 - Cobalt Blue","public_title":"Cobalt Blue","options":["Cobalt Blue"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST01184O9-EME11","featured_media":{"alt":null,"id":27862891626595,"position":12,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/3fa5d262d336f7bc0141907300896bff72edfad9_216da197-687d-4f67-ad9b-e3b84b4d3536.webp?v=1784788283"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43966956044387,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"SST0118452-EME11","requires_shipping":true,"taxable":true,"featured_image":{"id":36359107870819,"product_id":7956202455139,"position":10,"created_at":"2026-07-23T14:31:20+08:00","updated_at":"2026-07-23T14:31:22+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/278a99c64e6d40d45cda791fbb07fb9c32af89af_8cdbb6e3-f4cb-4af8-a9c0-d9f55c092aaf.webp?v=1784788282","variant_ids":[43966956044387]},"available":true,"name":"iPhone 12 mini SolidSuit Emerald Studio 夏 - Black","public_title":"Black","options":["Black"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST0118452-EME11","featured_media":{"alt":null,"id":27862890446947,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/278a99c64e6d40d45cda791fbb07fb9c32af89af_8cdbb6e3-f4cb-4af8-a9c0-d9f55c092aaf.webp?v=1784788282"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43966953390179,"title":"Shell Beige","option1":"Shell Beige","option2":null,"option3":null,"sku":"SST011840B-EME11","requires_shipping":true,"taxable":true,"featured_image":{"id":36359109607523,"product_id":7956202455139,"position":13,"created_at":"2026-07-23T14:31:22+08:00","updated_at":"2026-07-23T14:31:24+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f5d772859142c71d21a1d0c8e315b33c12aba38_483eee55-fb60-4c03-a201-bc84d3205e48.webp?v=1784788284","variant_ids":[43966953390179]},"available":true,"name":"iPhone 12 mini SolidSuit Emerald Studio 夏 - Shell Beige","public_title":"Shell Beige","options":["Shell Beige"],"price":83000,"weight":0,"compare_at_price":null,"inventory_quantity":0,"inventory_management":null,"inventory_policy":"deny","barcode":"SST011840B-EME11","featured_media":{"alt":null,"id":27862892183651,"position":13,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/5f5d772859142c71d21a1d0c8e315b33c12aba38_483eee55-fb60-4c03-a201-bc84d3205e48.webp?v=1784788284"}},"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: "停產"
}