Workflows
createAttributePossibleValuesWorkflow
This documentation provides a reference to thecreateAttributePossibleValuesWorkflow. It belongs to the @mercurjs/b2c-core package.
This workflow creates one or more possible values for an attribute.
Source code
Examples
- API Route
packages/modules/b2c-core/src/api/admin/attributes/[id]/values/route.ts
Steps
- createAttributePossibleValuesStep: This step creates one or more attribute possible values.
Input
The list of attribute values to create.
Output
The created attribute possible values.
createAttributeValueWorkflow
This documentation provides a reference to thecreateAttributeValueWorkflow. It belongs to the @mercurjs/b2c-core package.
This workflow creates an attribute value for a product and links it to the product. It handles the creation of the attribute value and the remote link between the product and the attribute value. It also includes validation to ensure the value is allowed for the attribute and that the product is associated with the attribute’s categories.
Source code
Examples
- API Route
- Another Workflow
packages/modules/b2c-core/src/api/vendor/products/[id]/options/route.ts
Steps
- validateAttributeValueStep: Validates that the value is allowed for the attribute and the product is compatible.
- createAttributeValueStep: Creates the attribute value record.
- createRemoteLinkStep: Links the created attribute value to the product.
Input
The details of the attribute value to create and link.
Output
The created attribute value.
createAttributesWorkflow
This documentation provides a reference to thecreateAttributesWorkflow. It belongs to the @mercurjs/b2c-core package.
This workflow creates one or more attributes and optionally links them to product categories.
Source code
Examples
- API Route
packages/modules/b2c-core/src/api/admin/attributes/route.ts
Steps
- createAttributesStep: Creates the attributes.
- createRemoteLinkStep: Links the created attributes to the specified product categories.
Input
Output
The created attributes.
deleteAttributeValueWorkflow
This documentation provides a reference to thedeleteAttributeValueWorkflow. It belongs to the @mercurjs/b2c-core package.
This workflow deletes one or more attribute values (the actual assigned values to products, not the definition possible values) and cleans up the links to products.
Source code
Examples
- API Route
packages/modules/b2c-core/src/api/vendor/products/[id]/options/[option_id]/route.ts
Steps
- useQueryGraphStep: Fetches the links between the attribute values and products to be dismissed.
- deleteAttributeValueStep: Soft deletes the attribute values.
- dismissRemoteLinkStep: Removes the links between the attribute values and products.
Input
The ID or IDs of the attribute values to delete.
Output
The IDs of the deleted attribute values.
deleteAttributeWorkflow
This documentation provides a reference to thedeleteAttributeWorkflow. It belongs to the @mercurjs/b2c-core package.
This workflow deletes an attribute definition.
Source code
Examples
- API Route
packages/modules/b2c-core/src/api/admin/attributes/[id]/route.ts
Steps
- deleteAttributeStep: Deletes the attribute and its associated links.
Input
Output
The workflow does not return a value.
updateAttributePossibleValueWorkflow
This documentation provides a reference to theupdateAttributePossibleValueWorkflow. It belongs to the @mercurjs/b2c-core package.
This workflow updates a possible value definition of an attribute (e.g., changing “Blue” to “Navy”).
Source code
Examples
- API Route
packages/modules/b2c-core/src/api/admin/attributes/[id]/values/[value_id]/route.ts
Steps
- updateAttributePossibleValueStep: Updates the attribute possible value.
Input
The details to update.
Output
The updated attribute possible value.
updateAttributesWorkflow
This documentation provides a reference to theupdateAttributesWorkflow. It belongs to the @mercurjs/b2c-core package.
This workflow updates one or more attributes, including their details, possible values, and category associations.
Source code
Examples
- API Route
packages/modules/b2c-core/src/api/admin/attributes/[id]/route.ts
Steps
- updateAttributesStep: Updates the attributes and their possible values.
- useQueryGraphStep: Fetches current category links to determine what to add or remove.
- dismissRemoteLinkStep: Removes links to categories that are no longer associated.
- createRemoteLinkStep: Creates links to newly associated categories.
Input
Output
The updated attributes.
Steps
createAttributePossibleValuesStep
Creates one or more attribute possible values. Source codeInput
List of values to create.
Output
The created values.
createAttributeValueStep
Creates an attribute value (assigned value). Source codeInput
The value data (excluding product ID which is linked separately).
Output
The created value.
createAttributesStep
Creates one or more attributes. It validates that no attribute with the same name exists. Source codeInput
List of attributes to create.
Output
The created attributes.
deleteAttributeValueStep
Soft deletes attribute values. Source codeInput
IDs of the values to delete.
Output
The IDs of deleted values.
deleteAttributeStep
Soft deletes an attribute and removes its links. Source codeInput
Output
No return value.
updateAttributePossibleValueStep
Updates a single attribute possible value. Source codeInput
The update data.
Output
The updated value.
updateAttributesStep
Updates attributes and their possible values. Uses upsert/replace logic for values. Source codeInput
List of attributes to update.
Output
The updated attributes.
validateAttributeValueStep
Validates that a value is allowed for a given attribute and product. It checks:- If the value is in the attribute’s
possible_values(if restricted). - If the product belongs to a category allowed by the attribute.
- If the product already has a value for this attribute (duplicate check).
Input
The value creation payload to validate.
Output
Throws an error if validation fails.