[Shopify]Checkout UI Extensionで設定項目の値を取得
const { banner_status } = useSettings();
const { banner_status } = useSettings();
Checkout UI Extensionのshopify.extension.toml
[[extensions.settings.fields]] key = "banner_status" type = "single_line_text_field" name = "バナーの状態" [[extensions.settings.fields.validations]] name = "choices" value = '["info", "success","warning","critical"]'
let j,productId; const cartLines = useCartLines(); const appMetafields = useAppMetafields(); if(appMetafields.length){ cartLines.forEach((cartLine,i)=>{ productId = cartLine.merchandise.product.id.split("/").pop(); for(j=0;j<appMetafields.length;j++){ if(appMetafields[j].target.id === productId){ if(appMetafields[j].metafield.key === "metafieldKey" && appMetafields[j].metafield.value === "metafieldValue"){ //処理 } break; } } }); }