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
createSellerCustomerGroupWorkflow
This documentation provides a reference to the createSellerCustomerGroupWorkflow. It belongs to the @mercurjs/b2c-core package.
This workflow creates a customer group for a seller and links it to the seller. It ensures that customer groups are properly associated with their respective sellers in the marketplace.
Source code
Examples
packages/modules/b2c-core/src/api/vendor/customer-groups/route.ts
import {
AuthenticatedMedusaRequest ,
MedusaResponse ,
} from "@medusajs/framework" ;
import { fetchSellerByAuthActorId } from "../../../shared/infra/http/utils" ;
import { createSellerCustomerGroupWorkflow } from "../../../workflows/customer-groups/workflows" ;
import { VendorCreateCustomerGroupType } from "./validators" ;
export const POST = async (
req : AuthenticatedMedusaRequest < VendorCreateCustomerGroupType >,
res : MedusaResponse
) => {
const seller = await fetchSellerByAuthActorId (
req . auth_context . actor_id ,
req . scope
);
const { result : customer_group } =
await createSellerCustomerGroupWorkflow . run ({
container: req . scope ,
input: {
... req . validatedBody ,
created_by: req . auth_context . actor_id ,
seller_id: seller . id ,
},
});
res . status ( 201 ). json ({
customer_group ,
});
};
Steps
createCustomerGroupsWorkflow : Creates the customer group using Medusa’s core workflow.
createRemoteLinkStep : Links the created customer group to the seller.
The customer group creation details. The name of the customer group.
The ID of the user creating the customer group.
The ID of the seller this customer group belongs to.
Output
The created customer group. The ID of the customer group.
The name of the customer group.
The ID of the user who created the group.
The date the customer group was created.
The date the customer group was last updated.