Implement commercetools product type schema with complex nested attributes and migrate attribute definitions without breaking existing product data
domain: commercetools.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Fetch the existing product type by ID from the productTypes endpoint and review its attribute definitions to understand the current schema before making changes
Add a new attribute to the product type using the addAttributeDefinition update action; if the attribute is required, note that existing products will not have this attribute and may fail validation until populated
For nested or complex attribute types such as nested type or set of nested, define the nested type as a product type referenced by name in the attribute definition; test with a small product batch before applying broadly
Roll out the new attribute by updating existing products in batches using the setAttributeInAllVariants update action to populate the new attribute value without requiring individual variant updates
If removing or renaming an attribute, use the removeAttributeDefinition update action only after confirming that no active products rely on it and no downstream systems are reading it
Test the schema migration in a non-production commercetools project by duplicating the product type and running the migration steps against test products before applying to production
Known gotchas
commercetools does not support renaming an existing attribute definition in place; the only way to rename is to add a new attribute with the new name, migrate all product data to the new attribute, and then remove the old one
Attributes of type nested reference another product type by name; renaming the referenced product type will break the nested attribute definition and all products using it
Adding a required attribute with no default value to an existing product type does not immediately fail, but products that are subsequently updated or published without the new required attribute will fail validation
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp