$product = {"id":7937942618211,"title":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 進擊的巨人 Attack on Titan Q版巨人","handle":"iphone-12-pro-mod-nx-magsafe-xu17","description":null,"published_at":"2025-12-12T10:27:42+08:00","created_at":"2025-12-11T16:03:32+08:00","vendor":"RHINOSHIELD Taiwan B2B","type":"","tags":["10%","20%","30%","40%","50%","brand-Apple","designer","designer-attack-on-titan","device-iPhone 12 Pro","merge","reseller-attack-on-titan"],"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":43884495470691,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-XU17","requires_shipping":true,"taxable":true,"featured_image":{"id":34933182529635,"product_id":7937942618211,"position":10,"created_at":"2025-12-11T16:03:41+08:00","updated_at":"2025-12-11T16:03:43+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/71ba23efcf74344660a8ea8e34a1a505195bb34b.webp?v=1765440223","variant_ids":[43884495470691]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 進擊的巨人 Attack on Titan Q版巨人 - 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-XU17","featured_media":{"alt":null,"id":26495554191459,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/71ba23efcf74344660a8ea8e34a1a505195bb34b.webp?v=1765440223"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884498616419,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-XU17","requires_shipping":true,"taxable":true,"featured_image":{"id":34933181349987,"product_id":7937942618211,"position":2,"created_at":"2025-12-11T16:03:37+08:00","updated_at":"2025-12-11T16:03:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab932bca3815254386fcc99b8fe19cb9cfea3337.webp?v=1765440218","variant_ids":[43884498616419]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 進擊的巨人 Attack on Titan Q版巨人 - 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-XU17","featured_media":{"alt":null,"id":26495553011811,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab932bca3815254386fcc99b8fe19cb9cfea3337.webp?v=1765440218"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884498780259,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-XU17","requires_shipping":true,"taxable":true,"featured_image":{"id":34933181579363,"product_id":7937942618211,"position":4,"created_at":"2025-12-11T16:03:38+08:00","updated_at":"2025-12-11T16:03:40+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d78c543c5cb0abc8a716262b997d19ea8abf8917.webp?v=1765440220","variant_ids":[43884498780259]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 進擊的巨人 Attack on Titan Q版巨人 - 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-XU17","featured_media":{"alt":null,"id":26495553241187,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d78c543c5cb0abc8a716262b997d19ea8abf8917.webp?v=1765440220"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884498845795,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-XU17","requires_shipping":true,"taxable":true,"featured_image":{"id":34933182398563,"product_id":7937942618211,"position":9,"created_at":"2025-12-11T16:03:40+08:00","updated_at":"2025-12-11T16:03:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e6fffb805894484aa50ae240cc38de4455bd635c.webp?v=1765440222","variant_ids":[43884498845795]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 進擊的巨人 Attack on Titan Q版巨人 - 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-XU17","featured_media":{"alt":null,"id":26495554060387,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e6fffb805894484aa50ae240cc38de4455bd635c.webp?v=1765440222"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884498878563,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-XU17","requires_shipping":true,"taxable":true,"featured_image":{"id":34933182038115,"product_id":7937942618211,"position":7,"created_at":"2025-12-11T16:03:39+08:00","updated_at":"2025-12-11T16:03:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/233d9f84805713c780c54596b2f492ef33142147.webp?v=1765440221","variant_ids":[43884498878563]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 進擊的巨人 Attack on Titan Q版巨人 - 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-XU17","featured_media":{"alt":null,"id":26495553699939,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/233d9f84805713c780c54596b2f492ef33142147.webp?v=1765440221"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ee6f156df5e999ffe3c49a5416b3bc89206188a.webp?v=1765440218","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab932bca3815254386fcc99b8fe19cb9cfea3337.webp?v=1765440218","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b14460660ddcd83da857a2da839a3637e75d0a7.webp?v=1765440219","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d78c543c5cb0abc8a716262b997d19ea8abf8917.webp?v=1765440220","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a757174a62a6d468b763a4e9985e4aa5000e2561.webp?v=1765440220","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9cc24892e072aada265caa622e0f9ce5fb3a461c.webp?v=1765440221","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/233d9f84805713c780c54596b2f492ef33142147.webp?v=1765440221","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/710652c491c93e14ee4d16e0fbb0e85846cd10f9.webp?v=1765440222","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e6fffb805894484aa50ae240cc38de4455bd635c.webp?v=1765440222","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/71ba23efcf74344660a8ea8e34a1a505195bb34b.webp?v=1765440223","\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8aaf82f040ee7b7b35dbd41ac995d82e8c53ad5.webp?v=1765440223"],"featured_image":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ee6f156df5e999ffe3c49a5416b3bc89206188a.webp?v=1765440218","options":["color"],"media":[{"alt":null,"id":26495552880739,"position":1,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ee6f156df5e999ffe3c49a5416b3bc89206188a.webp?v=1765440218"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/8ee6f156df5e999ffe3c49a5416b3bc89206188a.webp?v=1765440218","width":2000},{"alt":null,"id":26495553011811,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab932bca3815254386fcc99b8fe19cb9cfea3337.webp?v=1765440218"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab932bca3815254386fcc99b8fe19cb9cfea3337.webp?v=1765440218","width":2000},{"alt":null,"id":26495553142883,"position":3,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b14460660ddcd83da857a2da839a3637e75d0a7.webp?v=1765440219"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/1b14460660ddcd83da857a2da839a3637e75d0a7.webp?v=1765440219","width":2000},{"alt":null,"id":26495553241187,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d78c543c5cb0abc8a716262b997d19ea8abf8917.webp?v=1765440220"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d78c543c5cb0abc8a716262b997d19ea8abf8917.webp?v=1765440220","width":2000},{"alt":null,"id":26495553437795,"position":5,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a757174a62a6d468b763a4e9985e4aa5000e2561.webp?v=1765440220"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a757174a62a6d468b763a4e9985e4aa5000e2561.webp?v=1765440220","width":2000},{"alt":null,"id":26495553568867,"position":6,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9cc24892e072aada265caa622e0f9ce5fb3a461c.webp?v=1765440221"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/9cc24892e072aada265caa622e0f9ce5fb3a461c.webp?v=1765440221","width":2000},{"alt":null,"id":26495553699939,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/233d9f84805713c780c54596b2f492ef33142147.webp?v=1765440221"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/233d9f84805713c780c54596b2f492ef33142147.webp?v=1765440221","width":2000},{"alt":null,"id":26495553863779,"position":8,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/710652c491c93e14ee4d16e0fbb0e85846cd10f9.webp?v=1765440222"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/710652c491c93e14ee4d16e0fbb0e85846cd10f9.webp?v=1765440222","width":2000},{"alt":null,"id":26495554060387,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e6fffb805894484aa50ae240cc38de4455bd635c.webp?v=1765440222"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e6fffb805894484aa50ae240cc38de4455bd635c.webp?v=1765440222","width":2000},{"alt":null,"id":26495554191459,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/71ba23efcf74344660a8ea8e34a1a505195bb34b.webp?v=1765440223"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/71ba23efcf74344660a8ea8e34a1a505195bb34b.webp?v=1765440223","width":2000},{"alt":null,"id":26495554420835,"position":11,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8aaf82f040ee7b7b35dbd41ac995d82e8c53ad5.webp?v=1765440223"},"aspect_ratio":1.0,"height":2000,"media_type":"image","src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/a8aaf82f040ee7b7b35dbd41ac995d82e8c53ad5.webp?v=1765440223","width":2000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":null};
$isMerge = null;
$variants = [{"id":43884495470691,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-XU17","requires_shipping":true,"taxable":true,"featured_image":{"id":34933182529635,"product_id":7937942618211,"position":10,"created_at":"2025-12-11T16:03:41+08:00","updated_at":"2025-12-11T16:03:43+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/71ba23efcf74344660a8ea8e34a1a505195bb34b.webp?v=1765440223","variant_ids":[43884495470691]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 進擊的巨人 Attack on Titan Q版巨人 - 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-XU17","featured_media":{"alt":null,"id":26495554191459,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/71ba23efcf74344660a8ea8e34a1a505195bb34b.webp?v=1765440223"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884498616419,"title":"Graphite","option1":"Graphite","option2":null,"option3":null,"sku":"MPB0118569-XU17","requires_shipping":true,"taxable":true,"featured_image":{"id":34933181349987,"product_id":7937942618211,"position":2,"created_at":"2025-12-11T16:03:37+08:00","updated_at":"2025-12-11T16:03:38+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab932bca3815254386fcc99b8fe19cb9cfea3337.webp?v=1765440218","variant_ids":[43884498616419]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 進擊的巨人 Attack on Titan Q版巨人 - 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-XU17","featured_media":{"alt":null,"id":26495553011811,"position":2,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/ab932bca3815254386fcc99b8fe19cb9cfea3337.webp?v=1765440218"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884498780259,"title":"Black","option1":"Black","option2":null,"option3":null,"sku":"MPB0118524-XU17","requires_shipping":true,"taxable":true,"featured_image":{"id":34933181579363,"product_id":7937942618211,"position":4,"created_at":"2025-12-11T16:03:38+08:00","updated_at":"2025-12-11T16:03:40+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d78c543c5cb0abc8a716262b997d19ea8abf8917.webp?v=1765440220","variant_ids":[43884498780259]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 進擊的巨人 Attack on Titan Q版巨人 - 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-XU17","featured_media":{"alt":null,"id":26495553241187,"position":4,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/d78c543c5cb0abc8a716262b997d19ea8abf8917.webp?v=1765440220"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884498845795,"title":"White","option1":"White","option2":null,"option3":null,"sku":"MPB0118504-XU17","requires_shipping":true,"taxable":true,"featured_image":{"id":34933182398563,"product_id":7937942618211,"position":9,"created_at":"2025-12-11T16:03:40+08:00","updated_at":"2025-12-11T16:03:42+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e6fffb805894484aa50ae240cc38de4455bd635c.webp?v=1765440222","variant_ids":[43884498845795]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 進擊的巨人 Attack on Titan Q版巨人 - 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-XU17","featured_media":{"alt":null,"id":26495554060387,"position":9,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/e6fffb805894484aa50ae240cc38de4455bd635c.webp?v=1765440222"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}},{"id":43884498878563,"title":"Navy Blue","option1":"Navy Blue","option2":null,"option3":null,"sku":"MPB01185J5-XU17","requires_shipping":true,"taxable":true,"featured_image":{"id":34933182038115,"product_id":7937942618211,"position":7,"created_at":"2025-12-11T16:03:39+08:00","updated_at":"2025-12-11T16:03:41+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/233d9f84805713c780c54596b2f492ef33142147.webp?v=1765440221","variant_ids":[43884498878563]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 進擊的巨人 Attack on Titan Q版巨人 - 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-XU17","featured_media":{"alt":null,"id":26495553699939,"position":7,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/233d9f84805713c780c54596b2f492ef33142147.webp?v=1765440221"}},"requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}];
$defaultVariant = {"id":43884495470691,"title":"Lavender","option1":"Lavender","option2":null,"option3":null,"sku":"MPB01185C1-XU17","requires_shipping":true,"taxable":true,"featured_image":{"id":34933182529635,"product_id":7937942618211,"position":10,"created_at":"2025-12-11T16:03:41+08:00","updated_at":"2025-12-11T16:03:43+08:00","alt":null,"width":2000,"height":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/71ba23efcf74344660a8ea8e34a1a505195bb34b.webp?v=1765440223","variant_ids":[43884495470691]},"available":true,"name":"iPhone 12 \/ 12 Pro Mod NX (MagSafe 兼容) 進擊的巨人 Attack on Titan Q版巨人 - 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-XU17","featured_media":{"alt":null,"id":26495554191459,"position":10,"preview_image":{"aspect_ratio":1.0,"height":2000,"width":2000,"src":"\/\/b2b.rhinoshield.tw\/cdn\/shop\/files\/71ba23efcf74344660a8ea8e34a1a505195bb34b.webp?v=1765440223"}},"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: "停產"
}