Documentation Index Fetch the complete documentation index at: https://docs.mercurjs.com/llms.txt
Use this file to discover all available pages before exploring further.
Workflows
updateProductStatusWorkflow
This documentation provides a reference to the updateProductStatusWorkflow. It belongs to the @mercurjs/b2c-core package.
This workflow updates a product’s status. It is commonly used in approval flows to change a product from draft to published status, or to reject products that don’t meet marketplace requirements.
Source code
Examples
packages/modules/requests/src/workflows/requests/steps/update-related-product-status.ts
import { createStep } from "@medusajs/framework/workflows-sdk" ;
import {
REQUESTS_MODULE ,
RequestsModuleService ,
} from "../../../modules/requests" ;
import { updateProductStatusWorkflow } from "@mercurjs/framework" ;
export const updateRelatedProductStatusStep = createStep (
"update-related-product-status" ,
async ( id : string , { container }) => {
const service = container . resolve < RequestsModuleService >( REQUESTS_MODULE );
const request = await service . retrieveRequest ( id );
if (
[ "product" , "product_update" ]. includes ( request . type ) &&
request . status === "rejected"
) {
await updateProductStatusWorkflow . run ({
container ,
input: {
id: request . data . product_id ,
status: "rejected" ,
},
});
}
}
);
Steps
The product status update details. The ID of the product to update.
The new status for the product. Available statuses:
draft - Product is in draft mode
proposed - Product is proposed and awaiting approval
published - Product is published and visible
rejected - Product has been rejected
Output
The updated product. The updated status of the product.
The title of the product.
The handle of the product.
The date the product was created.
The date the product was last updated.
Steps
updateProductStatusStep
Updates a product’s status using the Product Module service.
Source code
The product status update details. The ID of the product to update.
The new status for the product.
Output