/b2c:b2c-metadatafrom b2c
Guides creation of custom attributes, object types, and site preferences for Salesforce B2C Commerce via metadata XML. Handles system-objecttype-extensions.xml, custom-objecttype-definitions.xml, and preferences.xml.
Ships in b2c. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill guides you through working with site metadata XML for Salesforce B2C Commerce, including custom attributes, custom objects, and site preferences.
This skill covers B2C Commerce metadata XML system (metadata.xsd namespace http://www.demandware.com/xml/impex/metadata/2006-10-31), including system-objecttype-extensions.xml, custom-objecttype-definitions.xml, and preferences.xml file structures. The examples show attribute types, enum value patterns, and Script API custom attribute access via dw.system.Site and ExtensibleObject.custom. Before answering questions that name specific B2C versions, XSD schema constraints, or emitting code the user will run, confirm current API shape and schema rules via b2c docs search and b2c docs read (CLI) or docs_search/docs_read (MCP). The canonical B2C Commerce documentation is the grounding source for metadata schema evolution, Script API signatures, and platform object types.
Canonical docs:
metadata - metadata XML schema and structuredw.system.Site - Script API for site preferencesdw.system.SitePreferences - Script API for site preferences accessdw.object.CustomAttributes - Script API for custom attribute accessb2c-commerce/b2c-create-impex-folder-structure-ds - site archive folder structureb2c-commerce/b2c-exporting-active-data - export guideb2c-commerce/creatingcustombusinessobjectswithdemandwarebusinessmanager - custom object creationb2c-commerce/b2c-business-manager-extension-points - Business Manager extension pointsMetadata defines the structure of your B2C Commerce data:
| Metadata Type | Purpose |
|---|---|
| System Object Extensions | Add custom attributes to Products, Orders, Customers, etc. |
| Custom Objects | Define entirely new data types |
| Site Preferences | Site-specific configuration values |
Metadata is organized in site archives:
/site-archive
/meta
system-objecttype-extensions.xml # Custom attributes on system objects
custom-objecttype-definitions.xml # Custom object definitions
/sites
/MySite
preferences.xml # Site preferences
Add custom attributes to existing system objects.
To inspect the attributes on a live instance, or to add or change a custom attribute or attribute group without an import, use
b2c object-types(seeb2c-cli:b2c-object-types). Enum values and custom object types still require metadata XML.
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.demandware.com/xml/impex/metadata/2006-10-31">
<type-extension type-id="Product">
<custom-attribute-definitions>
<attribute-definition attribute-id="myCustomAttribute">
<display-name xml:lang="x-default">My Custom Attribute</display-name>
<type>string</type>
<mandatory-flag>false</mandatory-flag>
<externally-managed-flag>false</externally-managed-flag>
</attribute-definition>
</custom-attribute-definitions>
<group-definitions>
<attribute-group group-id="MyCustomGroup">
<display-name xml:lang="x-default">My Custom Group</display-name>
<attribute attribute-id="myCustomAttribute"/>
</attribute-group>
</group-definitions>
</type-extension>
</metadata>
Illustrative list; confirm current platform object types with
b2c docs read b2c-commerce/creatingcustombusinessobjectswithdemandwarebusinessmanagerand Business Manager object reference.
| Object Type | Use Case |
|---|---|
Product | Product attributes |
Order | Order metadata |
Profile | Customer profile data |
Basket | Cart data |
SitePreferences | Site configuration |
Category | Category attributes |
Content | Content asset attributes |
See System Objects Reference for more types. The full set of extensible system objects is defined by the B2C platform — check Business Manager and official docs for version-specific availability.
Per metadata.xsd simpleType.AttributeType — confirm current schema with
b2c docs schema metadata.
| Type | Description | Example |
|---|---|---|
string | Text (max 4000 chars) | SKU, descriptions |
text | Long text (unlimited) | Rich content |
int | Integer | Quantity, rank |
double | Decimal | Percentage, weight |
boolean | true/false | Flags |
date | Date only | Birth date |
datetime | Date and time | Timestamps |
email | Email address | Contact email |
password | Encrypted | API keys |
html | HTML content | Rich text |
enum-of-string | Single select | Status |
enum-of-int | Numeric enum | Priority level |
set-of-string | Multi-select | Tags |
set-of-int | Numeric multi-select | Categories |
image | Image reference | Thumbnails |
Illustrative of enum structure; confirm current schema ordering constraints with
b2c docs schema metadata.
Enum types (enum-of-string, enum-of-int, set-of-string, set-of-int) require value-definitions with display/value pairs:
Element order matters. The metadata.xsd schema requires
<display>before<value>in each<value-definition>— seeb2c docs schema metadatafor current schema constraints.
<attribute-definition attribute-id="warrantyType">
<display-name xml:lang="x-default">Warranty Type</display-name>
<type>enum-of-string</type>
<mandatory-flag>false</mandatory-flag>
<value-definitions>
<value-definition>
<display xml:lang="x-default">No Warranty</display>
<value>none</value>
</value-definition>
<value-definition>
<display xml:lang="x-default">Limited Warranty</display>
<value>limited</value>
</value-definition>
<value-definition>
<display xml:lang="x-default">Full Warranty</display>
<value>full</value>
</value-definition>
</value-definitions>
</attribute-definition>
| Element | Purpose |
|---|---|
<display> | Human-readable label shown in Business Manager (must appear first) |
<value> | The stored/API value (use lowercase, no spaces) |
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.demandware.com/xml/impex/metadata/2006-10-31">
<type-extension type-id="Product">
<custom-attribute-definitions>
<!-- Simple string attribute -->
<attribute-definition attribute-id="vendorSKU">
<display-name xml:lang="x-default">Vendor SKU</display-name>
<type>string</type>
<mandatory-flag>false</mandatory-flag>
<externally-managed-flag>true</externally-managed-flag>
</attribute-definition>
<!-- Enum (dropdown) attribute -->
<attribute-definition attribute-id="productCondition">
<display-name xml:lang="x-default">Product Condition</display-name>
<type>enum-of-string</type>
<mandatory-flag>false</mandatory-flag>
<value-definitions>
<value-definition>
<display xml:lang="x-default">New</display>
<value>new</value>
</value-definition>
<value-definition>
<display xml:lang="x-default">Refurbished</display>
<value>refurbished</value>
</value-definition>
<value-definition>
<display xml:lang="x-default">Used</display>
<value>used</value>
</value-definition>
</value-definitions>
</attribute-definition>
<!-- Boolean attribute -->
<attribute-definition attribute-id="isHazardous">
<display-name xml:lang="x-default">Hazardous Material</display-name>
<type>boolean</type>
<mandatory-flag>false</mandatory-flag>
<default-value>false</default-value>
</attribute-definition>
<!-- Multi-select attribute -->
<attribute-definition attribute-id="productFeatures">
<display-name xml:lang="x-default">Product Features</display-name>
<type>set-of-string</type>
<mandatory-flag>false</mandatory-flag>
<value-definitions>
<value-definition>
<display xml:lang="x-default">Waterproof</display>
<value>waterproof</value>
</value-definition>
<value-definition>
<display xml:lang="x-default">Recyclable</display>
<value>recyclable</value>
</value-definition>
</value-definitions>
</attribute-definition>
</custom-attribute-definitions>
<group-definitions>
<attribute-group group-id="CustomProductInfo">
<display-name xml:lang="x-default">Custom Product Information</display-name>
<attribute attribute-id="vendorSKU"/>
<attribute attribute-id="productCondition"/>
<attribute attribute-id="isHazardous"/>
<attribute attribute-id="productFeatures"/>
</attribute-group>
</group-definitions>
</type-extension>
</metadata>
Create entirely new data types.
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.demandware.com/xml/impex/metadata/2006-10-31">
<custom-type type-id="StoreLocations">
<display-name xml:lang="x-default">Store Locations</display-name>
<description xml:lang="x-default">Physical store information</description>
<staging-mode>source-to-target</staging-mode>
<storage-scope>site</storage-scope>
<key-definition attribute-id="storeId">
<display-name xml:lang="x-default">Store ID</display-name>
<type>string</type>
<min-length>1</min-length>
</key-definition>
<attribute-definitions>
<attribute-definition attribute-id="storeName">
<display-name xml:lang="x-default">Store Name</display-name>
<type>string</type>
<mandatory-flag>true</mandatory-flag>
</attribute-definition>
<attribute-definition attribute-id="latitude">
<display-name xml:lang="x-default">Latitude</display-name>
<type>double</type>
</attribute-definition>
<attribute-definition attribute-id="longitude">
<display-name xml:lang="x-default">Longitude</display-name>
<type>double</type>
</attribute-definition>
<attribute-definition attribute-id="phone">
<display-name xml:lang="x-default">Phone</display-name>
<type>string</type>
</attribute-definition>
<attribute-definition attribute-id="isActive">
<display-name xml:lang="x-default">Active</display-name>
<type>boolean</type>
<default-value>true</default-value>
</attribute-definition>
</attribute-definitions>
<group-definitions>
<attribute-group group-id="StoreInfo">
<display-name xml:lang="x-default">Store Information</display-name>
<attribute attribute-id="storeId" system="true"/>
<attribute attribute-id="storeName"/>
<attribute attribute-id="latitude"/>
<attribute attribute-id="longitude"/>
<attribute attribute-id="phone"/>
<attribute attribute-id="isActive"/>
</attribute-group>
</group-definitions>
</custom-type>
</metadata>
Site-specific configuration via custom attributes on SitePreferences.
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://www.demandware.com/xml/impex/metadata/2006-10-31">
<type-extension type-id="SitePreferences">
<custom-attribute-definitions>
<attribute-definition attribute-id="enableFeatureX">
<display-name xml:lang="x-default">Enable Feature X</display-name>
<type>boolean</type>
<default-value>false</default-value>
</attribute-definition>
<attribute-definition attribute-id="apiEndpoint">
<display-name xml:lang="x-default">API Endpoint</display-name>
<type>string</type>
</attribute-definition>
<attribute-definition attribute-id="maxItemsPerPage">
<display-name xml:lang="x-default">Max Items Per Page</display-name>
<type>int</type>
<default-value>20</default-value>
</attribute-definition>
</custom-attribute-definitions>
<group-definitions>
<attribute-group group-id="CustomSettings">
<display-name xml:lang="x-default">Custom Settings</display-name>
<attribute attribute-id="enableFeatureX"/>
<attribute attribute-id="apiEndpoint"/>
<attribute attribute-id="maxItemsPerPage"/>
</attribute-group>
</group-definitions>
</type-extension>
</metadata>
Preferences can be set per instance type (development, staging, production) or for all instances:
<?xml version="1.0" encoding="UTF-8"?>
<preferences xmlns="http://www.demandware.com/xml/impex/preferences/2007-03-31">
<custom-preferences>
<all-instances>
<!-- Values that apply to all instance types -->
<preference preference-id="maxItemsPerPage">25</preference>
</all-instances>
<development>
<!-- Development-specific values -->
<preference preference-id="enableFeatureX">true</preference>
<preference preference-id="apiEndpoint">https://dev-api.example.com/v1</preference>
</development>
<staging>
<preference preference-id="enableFeatureX">true</preference>
<preference preference-id="apiEndpoint">https://staging-api.example.com/v1</preference>
</staging>
<production>
<preference preference-id="enableFeatureX">false</preference>
<preference preference-id="apiEndpoint">https://api.example.com/v1</preference>
</production>
</custom-preferences>
</preferences>
Illustrative code; confirm current API signatures and return types with
b2c docs read dw.system.Site.
// See dw.system.Site Script API docs for full method signatures and return types
var Site = require('dw/system/Site');
var enableFeatureX = Site.current.getCustomPreferenceValue('enableFeatureX');
var apiEndpoint = Site.current.getCustomPreferenceValue('apiEndpoint');
var maxItems = Site.current.getCustomPreferenceValue('maxItemsPerPage');
Illustrative of available flags; confirm current schema elements and deprecation status with
b2c docs schema metadata.
<attribute-definition attribute-id="myAttribute">
<display-name xml:lang="x-default">Display Name</display-name>
<description xml:lang="x-default">Description for BM tooltip</description>
<type>string</type>
<localizable-flag>false</localizable-flag>
<site-specific-flag>false</site-specific-flag>
<mandatory-flag>false</mandatory-flag>
<searchable-flag>false</searchable-flag>
<visible-flag>true</visible-flag>
<externally-managed-flag>false</externally-managed-flag>
<order-required-flag>false</order-required-flag>
<min-length>0</min-length>
<field-length>256</field-length>
<unit xml:lang="x-default">kg</unit>
<default-value>default</default-value>
</attribute-definition>
| Flag | Purpose |
|---|---|
localizable-flag | Can have different values per locale |
mandatory-flag | Required in BM |
externally-managed-flag | Read-only in BM |
visible-flag | Shown in BM |
site-specific-flag | Different value per site |
order-required-flag | Required for order export |
searchable-flag | Indexed for search (deprecated per metadata.xsd — use search2.xsd SearchableAttributes instead) |
acme_myAttribute)For canonical documentation, see the Scope & Grounding section above. The files below are derived quick-reference summaries.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub salesforcecommercecloud/b2c-developer-tooling --plugin b2c20 skills in this plugin
/b2c-business-manager-extensionsBuild Business Manager extension cartridges with custom admin tools, menu items, and dialog actions. Use this skill whenever the user needs to create bm_* cartridges, add menu actions or dialog buttons in BM, configure bm_extensions.xml, or extend admin pages with form overlays. Also use when customizing the BM interface for back-office workflows -- even if they just say 'add a button to BM' or 'custom admin page'./b2c-controllersCreate storefront controllers using SFRA or classic patterns with server.get/post, middleware chains, and res.render/json. Use this skill whenever the user needs to build a page route, handle form submissions, create AJAX endpoints, extend or override existing controllers, or add middleware to a request pipeline. Also use when debugging route registration or response rendering -- even if they just say 'new page endpoint' or 'handle a POST request'./b2c-custom-api-developmentDevelop Custom SCAPI REST endpoints with api.json routes, schema.yaml definitions, and OAuth scope configuration. Use this skill whenever the user needs to create a custom API on the Commerce platform, define OpenAPI 3.0 schemas for request/response, structure the rest-apis cartridge folder, or debug endpoint registration and 404 issues. Also use when building headless commerce integrations, choosing between Shopper (`ShopperToken`) and Admin (`AmOAuth2`) APIs, or troubleshooting why a Custom API endpoint isn't appearing or returning 404 in `b2c scapi custom status` — even if they just say 'custom REST endpoint', 'expose my script as an API', or 'my admin custom API isn't registering'./b2c-custom-cachesImplement custom caching with CacheMgr, caches.json definitions, and cache region configuration. Use this skill whenever the user needs to cache expensive computations or API responses server-side, define cache regions with TTL and size limits, invalidate cache entries, or debug disappearing cache data. Also use when optimizing script performance with application-level caching -- even if they just say 'cache this data' or 'my cached values keep disappearing'./b2c-custom-job-stepsCreate custom job steps for B2C Commerce batch processing. Use this skill whenever the user needs to write a batch job, data export script, scheduled cleanup task, or any server-side processing that runs on a schedule. Also use when they ask about steptypes.json, chunk-oriented vs task-oriented job steps, read/process/write patterns, how to get a custom job to appear in Business Manager, or how to author and import a jobs.xml job definition (job/flow/step structure, step type, the required triggers element) so a step type becomes a runnable, schedulable job — even if they just say "I need a script that runs nightly" or "batch process orders"./b2c-custom-objectsStore and query custom business data using CustomObjectMgr, OCAPI Data API, and Shopper Custom Objects API. Use this skill whenever the user needs to create, read, update, or search custom object instances, build processing queues with status fields, choose between site-scoped and organization-scoped storage, or query custom objects with bool/term filters. Also use when persisting non-standard data -- even if they just say 'store config per site' or 'query my custom data'.Other plugins' skills for the same job