Loading...
Loading...
Manage custom business configuration in an Adobe Commerce app. Use when the user wants to add, modify, or remove merchant-configurable settings (config fields, admin config, store configuration) exposed through Commerce Admin. Creates typed config fields (text, password, email, url, tel, boolean, list) in businessConfig.schema. Requires a base app initialized with commerce-app-init.
npx skill4agent add adobe/skills commerce-app-business-configbusinessConfig.schemaapp.commerce.config.tsapp.commerce.config.tssrc/commerce-extensibility-1/node_modules@adobe/aio-commerce-lib-appapp.commerce.config.tscommerce-app-initsrc/commerce-extensibility-1/node_modulesnpx @adobe/aio-commerce-lib-app initlisttextpasswordemailurltelbooleanlistselectionMode"single""multiple"optionslabelvalue| Field | Constraint |
|---|---|
| Required, non-empty string |
| Required; one of |
| Optional string |
| Optional string |
| Required for list fields: |
| Required for list fields; each option needs both |
| Required; must match one of the option |
| Optional array of strings (defaults to |
| Optional string (defaults to |
| Must be |
| Optional; |
| Optional; |
| Optional; |
| Optional boolean (defaults to |
businessConfig.schemaapp.commerce.config.tsbusinessConfig.schemabusinessConfigbusinessConfig.schemabusinessConfig: {
schema: [
// Password (masked input — API keys, secrets)
{ name: "api_key", type: "password", label: "API Key", default: "" },
// Single-select list
{
name: "region", type: "list", selectionMode: "single",
label: "Region",
options: [{ label: "EU", value: "eu" }, { label: "US", value: "us" }],
default: "eu", // required; must match an option value
},
// Boolean toggle
{ name: "debug_mode", type: "boolean", label: "Enable Debug Mode", default: false },
// Dynamic list — options resolved at runtime via a factory that receives the action's params.
// Required `default` factory for single-select; optional for multiple (falls back to []).
{
name: "paymentMethod", type: "dynamicList", selectionMode: "single",
label: "Default Payment Method",
options: async (params) => {
const methods = await fetchPaymentMethods(params.SOME_API_KEY);
return methods.map((m) => ({ label: m.title, value: m.code }));
},
default: (resolvedOptions) => resolvedOptions[0].value,
},
],
}commerce/configuration/1app.config.yamlinstall.yaml@adobe/aio-commerce-lib-confignpx @adobe/aio-commerce-lib-app initaio app build@adobe/aio-commerce-lib-configimport {
initialize,
getConfigurationByKey,
getConfiguration,
byCodeAndLevel,
} from "@adobe/aio-commerce-lib-config";
// Schema is generated by `aio app build` into .generated/configuration-schema.json
// under the commerce-configuration-1 extension; adjust the relative path for your action.
import schema from "../../.generated/configuration-schema.json" with { type: "json" };
export async function main(params) {
await initialize({ schema });
// Read a single field — config is null if the key has never been set
const { config } = await getConfigurationByKey(
"api_key", // the `name` from your schema
byCodeAndLevel("global", "global"), // scope
);
const apiKey = config?.value ?? "";
// Read all fields for a scope
const { config: allConfig } = await getConfiguration(
byCodeAndLevel("global", "global"),
);
// allConfig is an array of { name, value, origin } entries
return { statusCode: 200, body: { success: true } };
}| Selector | When to use |
|---|---|
| App-wide settings — applies to all stores |
| Per store view (most specific) |
| Resolves using the default level for the scope |
| When you have the scope's numeric ID from Commerce |
store_viewstorewebsiteglobalaio app buildAIO_COMMERCE_CONFIG_ENCRYPTION_KEY.envext.config.yamlinputs:
AIO_COMMERCE_CONFIG_ENCRYPTION_KEY: $AIO_COMMERCE_CONFIG_ENCRYPTION_KEYgetConfigurationByKeylist/singledefaultvaluedefineConfig@adobe/aio-commerce-lib-appdefineConfig@adobe/aio-commerce-lib-app/configaio app buildaio app buildcommerce-app-webhookscommerce-app-eventingcommerce-app-admin-ui