@mercurjs/docs 2.2.0-canary.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/README.md +24 -0
  2. package/content/blocks.mdx +209 -0
  3. package/content/learn/architecture.mdx +215 -0
  4. package/content/learn/attributes.mdx +89 -0
  5. package/content/learn/blocks.mdx +99 -0
  6. package/content/learn/commissions.mdx +175 -0
  7. package/content/learn/concepts.mdx +84 -0
  8. package/content/learn/installation.mdx +117 -0
  9. package/content/learn/introduction.mdx +71 -0
  10. package/content/learn/offers.mdx +78 -0
  11. package/content/learn/order-groups.mdx +114 -0
  12. package/content/learn/payouts.mdx +175 -0
  13. package/content/learn/product-requests.mdx +82 -0
  14. package/content/learn/products.mdx +79 -0
  15. package/content/learn/registry.mdx +155 -0
  16. package/content/learn/seller-members.mdx +62 -0
  17. package/content/learn/sellers.mdx +118 -0
  18. package/content/migration/from-1-x-to-2-0.mdx +152 -0
  19. package/content/migration/from-2-0-to-2-1.mdx +105 -0
  20. package/content/migration/overview.mdx +58 -0
  21. package/content/references/api/admin/commission-rates/batch-commission-rules.mdx +70 -0
  22. package/content/references/api/admin/commission-rates/create-commission-rate.mdx +95 -0
  23. package/content/references/api/admin/commission-rates/delete-commission-rate.mdx +40 -0
  24. package/content/references/api/admin/commission-rates/list-commission-rates.mdx +92 -0
  25. package/content/references/api/admin/commission-rates/retrieve-commission-rate.mdx +70 -0
  26. package/content/references/api/admin/commission-rates/update-commission-rate.mdx +84 -0
  27. package/content/references/api/admin/members/list-members.mdx +61 -0
  28. package/content/references/api/admin/offers/batch-create-offers.mdx +130 -0
  29. package/content/references/api/admin/offers/delete-offer.mdx +40 -0
  30. package/content/references/api/admin/offers/list-offers.mdx +106 -0
  31. package/content/references/api/admin/offers/retrieve-offer.mdx +82 -0
  32. package/content/references/api/admin/order-groups/list-order-groups.mdx +77 -0
  33. package/content/references/api/admin/order-groups/retrieve-order-group.mdx +56 -0
  34. package/content/references/api/admin/orders/get-order-commission-lines.mdx +65 -0
  35. package/content/references/api/admin/orders/get-order-order-group.mdx +56 -0
  36. package/content/references/api/admin/orders/list-orders.mdx +79 -0
  37. package/content/references/api/admin/payouts/list-payouts.mdx +75 -0
  38. package/content/references/api/admin/payouts/retrieve-payout.mdx +62 -0
  39. package/content/references/api/admin/product-attributes/create-attribute-value.mdx +76 -0
  40. package/content/references/api/admin/product-attributes/create-product-attribute.mdx +99 -0
  41. package/content/references/api/admin/product-attributes/delete-attribute-value.mdx +52 -0
  42. package/content/references/api/admin/product-attributes/delete-product-attribute.mdx +40 -0
  43. package/content/references/api/admin/product-attributes/list-product-attributes.mdx +91 -0
  44. package/content/references/api/admin/product-attributes/retrieve-product-attribute.mdx +81 -0
  45. package/content/references/api/admin/product-attributes/update-attribute-value.mdx +66 -0
  46. package/content/references/api/admin/product-attributes/update-product-attribute.mdx +76 -0
  47. package/content/references/api/admin/product-changes/cancel-product-change.mdx +68 -0
  48. package/content/references/api/admin/product-changes/confirm-product-change.mdx +47 -0
  49. package/content/references/api/admin/products/batch-product-attributes.mdx +96 -0
  50. package/content/references/api/admin/products/confirm-product.mdx +59 -0
  51. package/content/references/api/admin/products/create-product-variant.mdx +78 -0
  52. package/content/references/api/admin/products/create-product.mdx +169 -0
  53. package/content/references/api/admin/products/delete-product-variant.mdx +48 -0
  54. package/content/references/api/admin/products/delete-product.mdx +40 -0
  55. package/content/references/api/admin/products/list-product-variants.mdx +91 -0
  56. package/content/references/api/admin/products/list-products.mdx +109 -0
  57. package/content/references/api/admin/products/preview-product.mdx +78 -0
  58. package/content/references/api/admin/products/reject-product.mdx +59 -0
  59. package/content/references/api/admin/products/request-product-changes.mdx +59 -0
  60. package/content/references/api/admin/products/retrieve-product-variant.mdx +73 -0
  61. package/content/references/api/admin/products/retrieve-product.mdx +96 -0
  62. package/content/references/api/admin/products/set-product-sellers.mdx +47 -0
  63. package/content/references/api/admin/products/update-product-variant.mdx +89 -0
  64. package/content/references/api/admin/products/update-product.mdx +133 -0
  65. package/content/references/api/admin/sellers/add-seller-member.mdx +63 -0
  66. package/content/references/api/admin/sellers/approve-seller.mdx +54 -0
  67. package/content/references/api/admin/sellers/create-seller.mdx +100 -0
  68. package/content/references/api/admin/sellers/delete-member-invite.mdx +42 -0
  69. package/content/references/api/admin/sellers/delete-professional-details.mdx +52 -0
  70. package/content/references/api/admin/sellers/invite-seller-member.mdx +63 -0
  71. package/content/references/api/admin/sellers/list-member-invites.mdx +71 -0
  72. package/content/references/api/admin/sellers/list-seller-members.mdx +71 -0
  73. package/content/references/api/admin/sellers/list-seller-products.mdx +85 -0
  74. package/content/references/api/admin/sellers/list-sellers.mdx +96 -0
  75. package/content/references/api/admin/sellers/remove-seller-member.mdx +42 -0
  76. package/content/references/api/admin/sellers/resend-member-invite.mdx +55 -0
  77. package/content/references/api/admin/sellers/retrieve-seller.mdx +81 -0
  78. package/content/references/api/admin/sellers/suspend-seller.mdx +60 -0
  79. package/content/references/api/admin/sellers/terminate-seller.mdx +60 -0
  80. package/content/references/api/admin/sellers/unsuspend-seller.mdx +52 -0
  81. package/content/references/api/admin/sellers/unterminate-seller.mdx +52 -0
  82. package/content/references/api/admin/sellers/update-seller.mdx +83 -0
  83. package/content/references/api/admin/sellers/upsert-payment-details.mdx +88 -0
  84. package/content/references/api/admin/sellers/upsert-professional-details.mdx +78 -0
  85. package/content/references/api/admin/sellers/upsert-seller-address.mdx +91 -0
  86. package/content/references/api/admin.mdx +134 -0
  87. package/content/references/api/conventions.mdx +109 -0
  88. package/content/references/api/store/carts/add-line-item.mdx +115 -0
  89. package/content/references/api/store/carts/add-shipping-methods.mdx +84 -0
  90. package/content/references/api/store/carts/apply-promotions.mdx +83 -0
  91. package/content/references/api/store/carts/complete-cart.mdx +98 -0
  92. package/content/references/api/store/offers/list-offers.mdx +161 -0
  93. package/content/references/api/store/offers/retrieve-offer.mdx +112 -0
  94. package/content/references/api/store/order-groups/list-order-groups.mdx +105 -0
  95. package/content/references/api/store/order-groups/retrieve-order-group.mdx +78 -0
  96. package/content/references/api/store/product-attributes/list-product-attributes.mdx +134 -0
  97. package/content/references/api/store/product-attributes/retrieve-product-attribute.mdx +78 -0
  98. package/content/references/api/store/product-categories/list-product-categories.mdx +126 -0
  99. package/content/references/api/store/product-categories/retrieve-product-category.mdx +79 -0
  100. package/content/references/api/store/products/list-products.mdx +184 -0
  101. package/content/references/api/store/products/retrieve-product.mdx +107 -0
  102. package/content/references/api/store/search/search.mdx +136 -0
  103. package/content/references/api/store/sellers/list-sellers.mdx +105 -0
  104. package/content/references/api/store/sellers/retrieve-seller.mdx +62 -0
  105. package/content/references/api/store/shipping-options/list-shipping-options.mdx +74 -0
  106. package/content/references/api/store.mdx +67 -0
  107. package/content/references/api/vendor/members/accept-member-invite.mdx +65 -0
  108. package/content/references/api/vendor/members/retrieve-current-member.mdx +51 -0
  109. package/content/references/api/vendor/members/update-current-member.mdx +70 -0
  110. package/content/references/api/vendor/offers/batch-create-offers.mdx +123 -0
  111. package/content/references/api/vendor/offers/batch-offer-inventory-items.mdx +103 -0
  112. package/content/references/api/vendor/offers/create-offer.mdx +141 -0
  113. package/content/references/api/vendor/offers/delete-offer.mdx +51 -0
  114. package/content/references/api/vendor/offers/list-offers.mdx +125 -0
  115. package/content/references/api/vendor/offers/retrieve-offer.mdx +74 -0
  116. package/content/references/api/vendor/offers/update-offer.mdx +82 -0
  117. package/content/references/api/vendor/orders/cancel-fulfillment.mdx +63 -0
  118. package/content/references/api/vendor/orders/cancel-order.mdx +56 -0
  119. package/content/references/api/vendor/orders/complete-order.mdx +55 -0
  120. package/content/references/api/vendor/orders/create-fulfillment.mdx +76 -0
  121. package/content/references/api/vendor/orders/create-shipment.mdx +99 -0
  122. package/content/references/api/vendor/orders/get-order-commission-lines.mdx +66 -0
  123. package/content/references/api/vendor/orders/list-order-changes.mdx +75 -0
  124. package/content/references/api/vendor/orders/list-orders.mdx +103 -0
  125. package/content/references/api/vendor/orders/mark-fulfillment-delivered.mdx +62 -0
  126. package/content/references/api/vendor/orders/preview-order.mdx +65 -0
  127. package/content/references/api/vendor/orders/retrieve-order.mdx +84 -0
  128. package/content/references/api/vendor/payout-accounts/create-onboarding.mdx +68 -0
  129. package/content/references/api/vendor/payout-accounts/create-payout-account.mdx +59 -0
  130. package/content/references/api/vendor/payout-accounts/retrieve-payout-account-by-id.mdx +60 -0
  131. package/content/references/api/vendor/payout-accounts/retrieve-payout-account.mdx +77 -0
  132. package/content/references/api/vendor/payouts/list-payouts.mdx +90 -0
  133. package/content/references/api/vendor/payouts/retrieve-payout.mdx +63 -0
  134. package/content/references/api/vendor/product-attributes/list-product-attributes.mdx +135 -0
  135. package/content/references/api/vendor/product-attributes/retrieve-product-attribute.mdx +71 -0
  136. package/content/references/api/vendor/product-variants/list-variants.mdx +136 -0
  137. package/content/references/api/vendor/products/batch-product-attributes.mdx +104 -0
  138. package/content/references/api/vendor/products/cancel-product-change.mdx +62 -0
  139. package/content/references/api/vendor/products/create-product-variant.mdx +92 -0
  140. package/content/references/api/vendor/products/create-product.mdx +197 -0
  141. package/content/references/api/vendor/products/delete-product-variant.mdx +68 -0
  142. package/content/references/api/vendor/products/delete-product.mdx +62 -0
  143. package/content/references/api/vendor/products/list-product-variants.mdx +114 -0
  144. package/content/references/api/vendor/products/list-products.mdx +163 -0
  145. package/content/references/api/vendor/products/preview-product.mdx +61 -0
  146. package/content/references/api/vendor/products/retrieve-product-variant.mdx +76 -0
  147. package/content/references/api/vendor/products/retrieve-product.mdx +69 -0
  148. package/content/references/api/vendor/products/update-product-variant.mdx +104 -0
  149. package/content/references/api/vendor/products/update-product.mdx +148 -0
  150. package/content/references/api/vendor/sellers/create-seller.mdx +150 -0
  151. package/content/references/api/vendor/sellers/delete-professional-details.mdx +54 -0
  152. package/content/references/api/vendor/sellers/invite-seller-member.mdx +67 -0
  153. package/content/references/api/vendor/sellers/list-member-invites.mdx +82 -0
  154. package/content/references/api/vendor/sellers/list-seller-members.mdx +80 -0
  155. package/content/references/api/vendor/sellers/list-sellers.mdx +71 -0
  156. package/content/references/api/vendor/sellers/remove-seller-member.mdx +48 -0
  157. package/content/references/api/vendor/sellers/retrieve-current-seller-member.mdx +59 -0
  158. package/content/references/api/vendor/sellers/retrieve-current-seller.mdx +69 -0
  159. package/content/references/api/vendor/sellers/select-seller.mdx +44 -0
  160. package/content/references/api/vendor/sellers/update-current-seller.mdx +108 -0
  161. package/content/references/api/vendor/sellers/update-member-role.mdx +51 -0
  162. package/content/references/api/vendor/sellers/upsert-payment-details.mdx +74 -0
  163. package/content/references/api/vendor/sellers/upsert-professional-details.mdx +70 -0
  164. package/content/references/api/vendor/sellers/upsert-seller-address.mdx +81 -0
  165. package/content/references/api/vendor.mdx +150 -0
  166. package/content/references/configuration.mdx +155 -0
  167. package/content/references/modules/commission.mdx +106 -0
  168. package/content/references/modules/custom-fields.mdx +45 -0
  169. package/content/references/modules/media.mdx +55 -0
  170. package/content/references/modules/offer.mdx +64 -0
  171. package/content/references/modules/payout.mdx +121 -0
  172. package/content/references/modules/product-attribute.mdx +111 -0
  173. package/content/references/modules/product-edit.mdx +80 -0
  174. package/content/references/modules/search.mdx +112 -0
  175. package/content/references/modules/seller.mdx +175 -0
  176. package/content/references/overview.mdx +70 -0
  177. package/content/references/workflows/cart/add-seller-shipping-method-to-cart.mdx +44 -0
  178. package/content/references/workflows/cart/complete-cart-with-split-orders.mdx +36 -0
  179. package/content/references/workflows/cart/list-seller-shipping-options-for-cart.mdx +39 -0
  180. package/content/references/workflows/cart/update-cart-seller-promotions.mdx +42 -0
  181. package/content/references/workflows/commission/batch-commission-rules.mdx +45 -0
  182. package/content/references/workflows/commission/create-commission-rates.mdx +41 -0
  183. package/content/references/workflows/commission/delete-commission-rates.mdx +34 -0
  184. package/content/references/workflows/commission/refresh-order-commission-lines.mdx +30 -0
  185. package/content/references/workflows/commission/update-commission-rates.mdx +35 -0
  186. package/content/references/workflows/media/set-category-images.mdx +41 -0
  187. package/content/references/workflows/media/set-collection-images.mdx +41 -0
  188. package/content/references/workflows/member/accept-member-invite.mdx +33 -0
  189. package/content/references/workflows/member/add-seller-member.mdx +30 -0
  190. package/content/references/workflows/member/create-member-invites.mdx +34 -0
  191. package/content/references/workflows/member/delete-member-invite.mdx +24 -0
  192. package/content/references/workflows/member/remove-seller-member.mdx +28 -0
  193. package/content/references/workflows/member/resend-member-invite.mdx +28 -0
  194. package/content/references/workflows/member/update-member-role.mdx +28 -0
  195. package/content/references/workflows/member/update-member.mdx +35 -0
  196. package/content/references/workflows/offer/batch-offer-inventory-items.mdx +58 -0
  197. package/content/references/workflows/offer/create-offers.mdx +63 -0
  198. package/content/references/workflows/offer/delete-offers.mdx +35 -0
  199. package/content/references/workflows/offer/update-offers.mdx +51 -0
  200. package/content/references/workflows/order/cancel-order-fulfillment.mdx +34 -0
  201. package/content/references/workflows/order/confirm-claim-request.mdx +25 -0
  202. package/content/references/workflows/order/confirm-exchange-request.mdx +25 -0
  203. package/content/references/workflows/order/confirm-order-edit-request.mdx +25 -0
  204. package/content/references/workflows/order/confirm-return-receive.mdx +25 -0
  205. package/content/references/workflows/order/create-order-fulfillment.mdx +45 -0
  206. package/content/references/workflows/order-group/get-order-group-detail.mdx +29 -0
  207. package/content/references/workflows/order-group/get-order-groups-list.mdx +36 -0
  208. package/content/references/workflows/overview.mdx +72 -0
  209. package/content/references/workflows/payout/create-onboarding.mdx +36 -0
  210. package/content/references/workflows/payout/create-payout-account.mdx +33 -0
  211. package/content/references/workflows/payout/create-payout.mdx +30 -0
  212. package/content/references/workflows/payout/process-payout-for-webhook.mdx +32 -0
  213. package/content/references/workflows/product/confirm-products.mdx +46 -0
  214. package/content/references/workflows/product/create-products.mdx +63 -0
  215. package/content/references/workflows/product/link-sellers-to-product-category.mdx +40 -0
  216. package/content/references/workflows/product/link-sellers-to-product.mdx +40 -0
  217. package/content/references/workflows/product/reject-product.mdx +46 -0
  218. package/content/references/workflows/product/request-product-change.mdx +46 -0
  219. package/content/references/workflows/product-attribute/add-product-attributes-to-product.mdx +49 -0
  220. package/content/references/workflows/product-attribute/create-and-link-product-attributes-to-product.mdx +46 -0
  221. package/content/references/workflows/product-attribute/create-product-attribute-values.mdx +43 -0
  222. package/content/references/workflows/product-attribute/create-product-attributes.mdx +56 -0
  223. package/content/references/workflows/product-attribute/delete-product-attribute-values.mdx +30 -0
  224. package/content/references/workflows/product-attribute/delete-product-attributes.mdx +30 -0
  225. package/content/references/workflows/product-attribute/remove-product-attributes-from-product.mdx +29 -0
  226. package/content/references/workflows/product-attribute/update-product-attribute-values.mdx +44 -0
  227. package/content/references/workflows/product-attribute/update-product-attributes-on-product.mdx +41 -0
  228. package/content/references/workflows/product-attribute/update-product-attributes.mdx +48 -0
  229. package/content/references/workflows/product-attribute/upsert-product-attribute-values.mdx +43 -0
  230. package/content/references/workflows/product-edit/auto-confirm-product-change.mdx +39 -0
  231. package/content/references/workflows/product-edit/cancel-product-change.mdx +49 -0
  232. package/content/references/workflows/product-edit/confirm-product-change.mdx +57 -0
  233. package/content/references/workflows/product-edit/create-product-change.mdx +72 -0
  234. package/content/references/workflows/product-edit/reject-product-change.mdx +54 -0
  235. package/content/references/workflows/product-edit/stage-product-change.mdx +75 -0
  236. package/content/references/workflows/seller/approve-seller.mdx +34 -0
  237. package/content/references/workflows/seller/create-seller-account.mdx +59 -0
  238. package/content/references/workflows/seller/create-seller-defaults.mdx +22 -0
  239. package/content/references/workflows/seller/create-sellers.mdx +65 -0
  240. package/content/references/workflows/seller/delete-seller-professional-details.mdx +37 -0
  241. package/content/references/workflows/seller/delete-sellers.mdx +24 -0
  242. package/content/references/workflows/seller/invite-seller.mdx +28 -0
  243. package/content/references/workflows/seller/suspend-seller.mdx +35 -0
  244. package/content/references/workflows/seller/terminate-seller.mdx +35 -0
  245. package/content/references/workflows/seller/unsuspend-seller.mdx +34 -0
  246. package/content/references/workflows/seller/unterminate-seller.mdx +34 -0
  247. package/content/references/workflows/seller/update-seller-address.mdx +55 -0
  248. package/content/references/workflows/seller/update-seller-payment-details.mdx +52 -0
  249. package/content/references/workflows/seller/update-seller-professional-details.mdx +48 -0
  250. package/content/references/workflows/seller/update-sellers.mdx +57 -0
  251. package/content/resources/ai/llms.mdx +74 -0
  252. package/content/resources/ai/mcp.mdx +152 -0
  253. package/content/resources/ai/overview.mdx +97 -0
  254. package/content/resources/customization/custom-fields.mdx +182 -0
  255. package/content/resources/customization/extend-a-workflow.mdx +39 -0
  256. package/content/resources/customization/extending-panels.mdx +309 -0
  257. package/content/resources/deployment/medusa-cloud.mdx +167 -0
  258. package/content/resources/integrations/notifications.mdx +39 -0
  259. package/content/resources/integrations/search.mdx +122 -0
  260. package/content/resources/integrations/stripe-connect.mdx +395 -0
  261. package/content/resources/tutorials/add-a-block.mdx +74 -0
  262. package/content/resources/tutorials/attributes-and-variant-axes.mdx +111 -0
  263. package/content/resources/tutorials/build-a-block.mdx +134 -0
  264. package/content/resources/tutorials/configure-commissions.mdx +127 -0
  265. package/content/resources/tutorials/custom-api-route.mdx +142 -0
  266. package/content/resources/tutorials/custom-panel-page.mdx +78 -0
  267. package/content/resources/tutorials/first-marketplace.mdx +45 -0
  268. package/content/resources/tutorials/handle-product-requests.mdx +80 -0
  269. package/content/resources/tutorials/import-export-products.mdx +96 -0
  270. package/content/resources/tutorials/master-products-and-offers.mdx +89 -0
  271. package/content/resources/tutorials/recompose-a-page.mdx +129 -0
  272. package/content/resources/tutorials/replace-panel-components.mdx +116 -0
  273. package/content/resources/tutorials/seller-payouts-stripe.mdx +89 -0
  274. package/content/telemetry.mdx +67 -0
  275. package/content/tools/api-client.mdx +155 -0
  276. package/content/tools/cli.mdx +196 -0
  277. package/content/tools/dashboard-sdk.mdx +35 -0
  278. package/content/user-guide/admin/overview.mdx +23 -0
  279. package/content/user-guide/admin/stores.mdx +193 -0
  280. package/content/user-guide/vendor/overview.mdx +23 -0
  281. package/content/user-guide/vendor/stores.mdx +209 -0
  282. package/llms.txt +307 -0
  283. package/package.json +33 -0
@@ -0,0 +1,45 @@
1
+ ---
2
+ title: "createOrderFulfillmentWorkflow"
3
+ description: "Create a fulfillment for order items, offer-bundle aware."
4
+ ---
5
+
6
+ Mercur's offer-aware replacement for Medusa's create-order-fulfillment flow. Validates the order and items, creates the fulfillment, registers it on the order, links it, and consumes reservations / adjusts inventory — multiplying quantities by each offer's `required_quantity` inventory links so bundle offers deduct the right stock. Triggered by `POST /vendor/orders/:id/fulfillments`. Emits `order.fulfillment_created`.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { createOrderFulfillmentWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ const { result } = await createOrderFulfillmentWorkflow(container).run({
14
+ input: {
15
+ order_id: "order_123",
16
+ items: [{ id: "ordli_123", quantity: 1 }],
17
+ },
18
+ })
19
+ ```
20
+
21
+ ## Input
22
+
23
+ <ParamField body="order_id" type="string" required>The order to fulfill.</ParamField>
24
+ <ParamField body="items" type="{ id: string; quantity: number }[]" required>Order line items and quantities to fulfill; all items must either require shipping or not — mixed requests throw.</ParamField>
25
+ <ParamField body="location_id" type="string">Stock location to fulfill from; defaults to the shipping option's linked location.</ParamField>
26
+ <ParamField body="shipping_option_id" type="string">Shipping option to fulfill with; defaults to the order's first shipping method.</ParamField>
27
+ <ParamField body="created_by" type="string">Id of the user creating the fulfillment.</ParamField>
28
+ <ParamField body="labels" type="FulfillmentLabelDTO[]">Tracking labels to attach.</ParamField>
29
+ <ParamField body="no_notification" type="boolean">Suppress customer notification for this fulfillment.</ParamField>
30
+ <ParamField body="metadata" type="object | null">Custom key-value data on the fulfillment.</ParamField>
31
+ <ParamField body="additional_data" type="object">Custom data passed through to the hooks.</ParamField>
32
+
33
+ ## Result
34
+
35
+ <ResponseField name="result" type="FulfillmentDTO">The created fulfillment.</ResponseField>
36
+
37
+ ## Hooks
38
+
39
+ - `fulfillmentCreated` — runs after creation with `{ fulfillment, additional_data }`.
40
+
41
+ ```ts
42
+ createOrderFulfillmentWorkflow.hooks.fulfillmentCreated(async ({ fulfillment }) => {
43
+ // push to a 3PL
44
+ })
45
+ ```
@@ -0,0 +1,29 @@
1
+ ---
2
+ title: "getOrderGroupDetailWorkflow"
3
+ description: "Retrieve one order group with per-order aggregated payment and fulfillment statuses."
4
+ ---
5
+
6
+ Loads an order group with its child orders and computes each order's `payment_status` and `fulfillment_status` from its payment collections and fulfillments. Payment collections and fulfillments are stripped from the response unless the requested fields include them. Triggered by `GET /admin/order-groups/:id` and `GET /admin/orders/:id/order-group`.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { getOrderGroupDetailWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ const { result } = await getOrderGroupDetailWorkflow(container).run({
14
+ input: {
15
+ order_group_id: "ordgrp_123",
16
+ fields: ["display_id", "total", "orders.display_id"],
17
+ },
18
+ })
19
+ ```
20
+
21
+ ## Input
22
+
23
+ <ParamField body="order_group_id" type="string" required>The order group to retrieve; fails if not found.</ParamField>
24
+ <ParamField body="fields" type="string[]" required>Fields to retrieve; merged with the defaults needed for status aggregation (`orders.items.*`, payment collection and fulfillment timestamps).</ParamField>
25
+
26
+ ## Result
27
+
28
+ <ResponseField name="result" type="object">The order group with its child orders.</ResponseField>
29
+ <ResponseField name="result.orders" type="OrderDetailDTO[]">Child orders, each with computed `payment_status` and `fulfillment_status`.</ResponseField>
@@ -0,0 +1,36 @@
1
+ ---
2
+ title: "getOrderGroupsListWorkflow"
3
+ description: "List order groups with pagination and per-order aggregated statuses."
4
+ ---
5
+
6
+ Lists order groups with their child orders, computing each order's `payment_status` and `fulfillment_status` from payment collections and fulfillments. When `sellerId` is set, each group's `orders` array is filtered to that seller's orders — useful for vendor-scoped views. Payment collections and fulfillments are stripped unless the requested fields include them. Triggered by `GET /admin/order-groups`.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { getOrderGroupsListWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ const { result } = await getOrderGroupsListWorkflow(container).run({
14
+ input: {
15
+ fields: ["display_id", "total"],
16
+ variables: { skip: 0, take: 20, order: { created_at: "DESC" } },
17
+ },
18
+ })
19
+ ```
20
+
21
+ ## Input
22
+
23
+ <ParamField body="fields" type="string[]" required>Fields to retrieve; merged with the defaults needed for status aggregation.</ParamField>
24
+ <ParamField body="variables" type="object">Query filters plus pagination.
25
+ <Expandable title="properties">
26
+ <ParamField body="skip" type="number">Number of groups to skip.</ParamField>
27
+ <ParamField body="take" type="number">Number of groups to return.</ParamField>
28
+ <ParamField body="order" type="object">Sort spec, e.g. `{ created_at: "DESC" }`.</ParamField>
29
+ </Expandable>
30
+ </ParamField>
31
+ <ParamField body="sellerId" type="string | string[]">Restrict each group's `orders` to the given seller(s).</ParamField>
32
+
33
+ ## Result
34
+
35
+ <ResponseField name="result.rows" type="object[]">The order groups; each child order carries computed `payment_status` and `fulfillment_status`.</ResponseField>
36
+ <ResponseField name="result.metadata" type="object">Pagination metadata (`count`, `skip`, `take`).</ResponseField>
@@ -0,0 +1,72 @@
1
+ ---
2
+ title: "Workflows"
3
+ description: "Every workflow exported by @mercurjs/core, grouped by domain."
4
+ ---
5
+
6
+ All marketplace business logic runs through Medusa workflows exported from `@mercurjs/core/workflows`. Run them from your own API routes, jobs, or subscribers, and extend them through their hooks — see [Extend a workflow](/rc/resources/customization/extend-a-workflow).
7
+
8
+ ```ts
9
+ import { createSellersWorkflow } from "@mercurjs/core/workflows"
10
+
11
+ const { result } = await createSellersWorkflow(container).run({
12
+ input: { name: "Acme", email: "hello@acme.co" },
13
+ })
14
+ ```
15
+
16
+ Each workflow has its own reference page with the exact input, result, and hooks.
17
+
18
+ <CardGroup cols={2}>
19
+ <Card title="Seller lifecycle" href="/rc/references/workflows/seller/create-sellers">
20
+ Create, approve, suspend, terminate sellers and manage their details.
21
+ </Card>
22
+ <Card title="Members & invites" href="/rc/references/workflows/member/add-seller-member">
23
+ Team management and the JWT invite flow.
24
+ </Card>
25
+ <Card title="Checkout & carts" href="/rc/references/workflows/cart/complete-cart-with-split-orders">
26
+ The multi-vendor split checkout and per-seller cart operations.
27
+ </Card>
28
+ <Card title="Order groups" href="/rc/references/workflows/order-group/get-order-group-detail">
29
+ Read models over grouped per-seller orders.
30
+ </Card>
31
+ <Card title="Commission" href="/rc/references/workflows/commission/create-commission-rates">
32
+ Rate CRUD, rule batching, and order line recomputation.
33
+ </Card>
34
+ <Card title="Payout" href="/rc/references/workflows/payout/create-payout">
35
+ Accounts, onboarding, payouts, and webhook processing.
36
+ </Card>
37
+ <Card title="Products" href="/rc/references/workflows/product/create-products">
38
+ Master product creation, confirmation, and seller linking.
39
+ </Card>
40
+ <Card title="Product edit" href="/rc/references/workflows/product-edit/create-product-change">
41
+ The change-request lifecycle behind vendor edits.
42
+ </Card>
43
+ <Card title="Product attributes" href="/rc/references/workflows/product-attribute/create-and-link-product-attributes-to-product">
44
+ Attribute catalog CRUD and the product batch engine.
45
+ </Card>
46
+ <Card title="Offers" href="/rc/references/workflows/offer/create-offers">
47
+ Listing CRUD and inventory item batching.
48
+ </Card>
49
+ <Card title="Media" href="/rc/references/workflows/media/set-collection-images">
50
+ Category and collection galleries, thumbnails, banners, icons.
51
+ </Card>
52
+ <Card title="Orders & RMA" href="/rc/references/workflows/order/create-order-fulfillment">
53
+ Fulfillment and return/claim/exchange confirmation.
54
+ </Card>
55
+ </CardGroup>
56
+
57
+ ## Internal and utility workflows
58
+
59
+ These are exported but usually not called directly — they run inside the workflows above:
60
+
61
+ | Workflow | Called by |
62
+ | --- | --- |
63
+ | `applyProductChangeActionsWorkflow` / `applyProductAttributeChangeActionsWorkflow` | `confirmProductChangeWorkflow` — replays staged actions onto the product |
64
+ | `productEditUpdateProductWorkflow` / `productEditUpdateVariantsWorkflow` / `productEditUpdateAttributesWorkflow` / `productEditDeleteProductWorkflow` | Vendor product edit routes — stage the corresponding change actions |
65
+ | `recordProductAuditChangeWorkflow` | Product flows — writes audit change records |
66
+ | `create/update/deleteProductCategoryWithImagesWorkflow` and `create/update/deleteProductCollectionWithImagesWorkflow` | Admin category/collection routes — wrap Medusa's workflows plus the image-set step |
67
+ | `createSellerCampaignsWorkflow`, `createSellerCustomerGroupsWorkflow`, `createSellerInventoryItemsWorkflow`, `createSellerPriceListsWorkflow`, `createSellerPromotionsWorkflow`, `createSellerShippingOptionsWorkflow`, `createSellerShippingProfilesWorkflow`, `createSellerStockLocationsWorkflow` | Vendor resource-create routes — create the record and link it to the seller |
68
+
69
+ <Note>
70
+ Search has no workflows by design — index synchronization is event-driven
71
+ through subscribers. See the [Search module](/rc/references/modules/search#index-synchronization).
72
+ </Note>
@@ -0,0 +1,36 @@
1
+ ---
2
+ title: "createOnboardingWorkflow"
3
+ description: "Start a provider onboarding session for a payout account."
4
+ ---
5
+
6
+ Creates an onboarding session for an existing payout account through the payout provider — for Stripe Connect this returns a hosted onboarding link the seller completes in the browser. Triggered by `POST /vendor/payout-accounts/:id/onboarding`.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { createOnboardingWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ const { result } = await createOnboardingWorkflow(container).run({
14
+ input: {
15
+ account_id: "pacc_123",
16
+ data: {
17
+ refresh_url: "https://vendor.example.com/payouts",
18
+ return_url: "https://vendor.example.com/payouts",
19
+ },
20
+ },
21
+ })
22
+ ```
23
+
24
+ ## Input
25
+
26
+ <ParamField body="account_id" type="string" required>The payout account to onboard.</ParamField>
27
+ <ParamField body="context" type="object">Provider context; supports `idempotency_key` plus provider-specific keys.</ParamField>
28
+ <ParamField body="data" type="object">Provider-specific onboarding data (e.g. Stripe `refresh_url` / `return_url`).</ParamField>
29
+
30
+ ## Result
31
+
32
+ <ResponseField name="result" type="OnboardingDTO">The created onboarding session.</ResponseField>
33
+ <ResponseField name="result.id" type="string">Onboarding ID.</ResponseField>
34
+ <ResponseField name="result.account_id" type="string">The payout account the session belongs to.</ResponseField>
35
+ <ResponseField name="result.data" type="object | null">Provider response data (e.g. the hosted onboarding URL).</ResponseField>
36
+ <ResponseField name="result.context" type="object | null">The context the session was created with.</ResponseField>
@@ -0,0 +1,33 @@
1
+ ---
2
+ title: "createPayoutAccountWorkflow"
3
+ description: "Create a payout account for a seller through the registered payout provider."
4
+ ---
5
+
6
+ Validates that the seller doesn't already have a payout account, creates one through the payout provider (e.g. Stripe Connect), and links it to the seller. Triggered by `POST /vendor/payout-accounts`.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { createPayoutAccountWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ const { result } = await createPayoutAccountWorkflow(container).run({
14
+ input: {
15
+ seller_id: "sel_123",
16
+ context: { country: "US" },
17
+ },
18
+ })
19
+ ```
20
+
21
+ ## Input
22
+
23
+ <ParamField body="seller_id" type="string" required>The seller to create the payout account for; fails if the seller already has one.</ParamField>
24
+ <ParamField body="context" type="object">Provider context; supports `idempotency_key` plus provider-specific keys.</ParamField>
25
+ <ParamField body="data" type="object">Provider-specific creation data passed straight to the payout provider.</ParamField>
26
+
27
+ ## Result
28
+
29
+ <ResponseField name="result" type="PayoutAccountDTO">The created payout account.</ResponseField>
30
+ <ResponseField name="result.id" type="string">Payout account ID.</ResponseField>
31
+ <ResponseField name="result.status" type="string">One of `pending`, `active`, `restricted`, `rejected`; starts as `pending` until onboarding completes.</ResponseField>
32
+ <ResponseField name="result.data" type="object">Provider-side account data (e.g. the connected account payload).</ResponseField>
33
+ <ResponseField name="result.context" type="object | null">The context the account was created with.</ResponseField>
@@ -0,0 +1,30 @@
1
+ ---
2
+ title: "createPayoutWorkflow"
3
+ description: "Issue a payout to a seller through the registered provider."
4
+ ---
5
+
6
+ Loads a settled order with its seller and payout account, sums the order's commission lines (item and shipping), and pays out `order.total - total commission` through the payout provider, linking the payout to the seller. Fails if the seller has no payout account. The order ID doubles as the provider idempotency key, so re-running for the same order is safe. Not wired to a route — run it from your own subscriber or scheduled job once an order is captured and ready to settle.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { createPayoutWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ const { result } = await createPayoutWorkflow(container).run({
14
+ input: { order_id: "order_123" },
15
+ })
16
+ ```
17
+
18
+ ## Input
19
+
20
+ <ParamField body="order_id" type="string" required>The order to settle; must belong to a seller with a payout account.</ParamField>
21
+
22
+ ## Result
23
+
24
+ <ResponseField name="result" type="PayoutDTO">The created payout.</ResponseField>
25
+ <ResponseField name="result.id" type="string">Payout ID.</ResponseField>
26
+ <ResponseField name="result.account_id" type="string">The seller's payout account.</ResponseField>
27
+ <ResponseField name="result.amount" type="BigNumberInput">Order total minus the order's commission lines.</ResponseField>
28
+ <ResponseField name="result.currency_code" type="string">The order's currency.</ResponseField>
29
+ <ResponseField name="result.status" type="string">One of `pending`, `processing`, `paid`, `failed`, `canceled`.</ResponseField>
30
+ <ResponseField name="result.data" type="object | null">Provider transfer data; includes `order_id` and `seller_id`.</ResponseField>
@@ -0,0 +1,32 @@
1
+ ---
2
+ title: "processPayoutForWebhookWorkflow"
3
+ description: "Apply a payout provider webhook event to the matching account or payout."
4
+ ---
5
+
6
+ Maps a normalized provider webhook action to a status update: account events set the payout account to `active`, `restricted`, or `rejected`; payout events set the payout to `processing`, `paid`, `failed`, or `canceled`. Unsupported actions (or events without an ID) are ignored. Triggered by the `payout-webhook` subscriber after the payout provider parses the raw webhook payload.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { processPayoutForWebhookWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ await processPayoutForWebhookWorkflow(container).run({
14
+ input: {
15
+ action: "payout.paid",
16
+ data: { id: "payout_123" },
17
+ },
18
+ })
19
+ ```
20
+
21
+ ## Input
22
+
23
+ <ParamField body="action" type="string" required>One of `account.activated`, `account.restricted`, `account.rejected`, `payout.processing`, `payout.paid`, `payout.failed`, `payout.canceled`, `not_supported`.</ParamField>
24
+ <ParamField body="data" type="object">Event target; nothing happens when omitted.
25
+ <Expandable title="properties">
26
+ <ParamField body="id" type="string" required>The ID of the payout account (for `account.*` actions) or the payout (for `payout.*` actions).</ParamField>
27
+ </Expandable>
28
+ </ParamField>
29
+
30
+ ## Result
31
+
32
+ <ResponseField name="result" type="void">No return value; the matching account or payout status is updated as a side effect.</ResponseField>
@@ -0,0 +1,46 @@
1
+ ---
2
+ title: "confirmProductsWorkflow"
3
+ description: "Approve proposed products and publish them to the catalog."
4
+ ---
5
+
6
+ Approves products awaiting review: validates every product is in `proposed` status, sets them to `published`, and records a confirmed `STATUS_CHANGE` audit action per product. Triggered by `POST /admin/products/:id/confirm`. Emits `product.published` with one `{ id, internal_note }` entry per product.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { confirmProductsWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ await confirmProductsWorkflow(container).run({
14
+ input: {
15
+ product_ids: ["prod_01H..."],
16
+ actor_id: "user_01H...",
17
+ internal_note: "Approved after review",
18
+ },
19
+ })
20
+ ```
21
+
22
+ ## Input
23
+
24
+ <ParamField body="product_ids" type="string[]" required>
25
+ Ids of the products to publish. Every product must currently be in `proposed` status.
26
+ </ParamField>
27
+
28
+ <ParamField body="actor_id" type="string">
29
+ Actor id recorded on the audit trail entry.
30
+ </ParamField>
31
+
32
+ <ParamField body="internal_note" type="string">
33
+ Operator-only note stored on the audit change and included in the emitted event.
34
+ </ParamField>
35
+
36
+ ## Result
37
+
38
+ <ResponseField name="result" type="void">
39
+ Returns nothing; the products are updated in place.
40
+ </ResponseField>
41
+
42
+ ## Hooks
43
+
44
+ <ResponseField name="productsConfirmed" type="hook">
45
+ Runs after publishing with `{ product_ids, internal_note }`.
46
+ </ResponseField>
@@ -0,0 +1,63 @@
1
+ ---
2
+ title: "createProductsWorkflow"
3
+ description: "Create master catalog products with seller eligibility and creator attribution."
4
+ ---
5
+
6
+ Creates master catalog products, resolving Mercur `attributes` inputs into native product options and value links, linking each product to its eligible sellers (`product_seller` links), and recording a confirmed `PRODUCT_ADD` audit action attributed to `created_by`. Triggered by `POST /admin/products` and `POST /vendor/products`. Variants default to `manage_inventory: false` unless set explicitly. Emits `product.created`.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { createProductsWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ const { result } = await createProductsWorkflow(container).run({
14
+ input: {
15
+ products: [{ title: "Linen Shirt", seller_ids: ["sel_01H..."] }],
16
+ created_by: "sel_01H...",
17
+ },
18
+ })
19
+ ```
20
+
21
+ ## Input
22
+
23
+ <ParamField body="products" type="object[]" required>
24
+ Products to create.
25
+ <Expandable title="properties">
26
+ <ParamField body="title" type="string" required>
27
+ The product title. All Medusa `CreateProductDTO` fields (handle, description, status, variants, categories, images, etc.) are accepted, except `options`.
28
+ </ParamField>
29
+ <ParamField body="attributes" type="ProductAttributeBatchAdd[]">
30
+ Attribute inputs resolved into native options and value links — `{ id, value_ids }` / `{ id, value }` for existing attributes, or `{ title, values, is_variant_axis }` / `{ title, type, value }` for inline ones. Do not pass native `options`.
31
+ </ParamField>
32
+ <ParamField body="seller_ids" type="string[]">
33
+ Seller ids to link to the product as eligible sellers.
34
+ </ParamField>
35
+ <ParamField body="variants" type="object[]">
36
+ Variants to create; `options` name-maps bind them to axis attributes. `manage_inventory` defaults to `false`.
37
+ </ParamField>
38
+ </Expandable>
39
+ </ParamField>
40
+
41
+ <ParamField body="created_by" type="string" required>
42
+ Actor id recorded on the `PRODUCT_ADD` audit action.
43
+ </ParamField>
44
+
45
+ <ParamField body="additional_data" type="object">
46
+ Arbitrary data forwarded to the underlying Medusa create workflows and the `productsCreated` hook.
47
+ </ParamField>
48
+
49
+ ## Result
50
+
51
+ <ResponseField name="result" type="ProductDTO[]">
52
+ The created products, including their generated ids, options, and statuses.
53
+ </ResponseField>
54
+
55
+ ## Hooks
56
+
57
+ <ResponseField name="validate" type="hook">
58
+ Runs first with `{ input, products }` — use it to reject invalid payloads before anything is created.
59
+ </ResponseField>
60
+
61
+ <ResponseField name="productsCreated" type="hook">
62
+ Runs after creation with `{ products, additional_data }`.
63
+ </ResponseField>
@@ -0,0 +1,40 @@
1
+ ---
2
+ title: "linkSellersToProductCategoryWorkflow"
3
+ description: "Add or remove seller eligibility links on a product category."
4
+ ---
5
+
6
+ Updates which sellers are allowed to sell in a product category by creating and removing seller–category links in one call — the mechanism behind restricted categories. Triggered by `POST /admin/product-categories/:id/sellers`. No events are emitted.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { linkSellersToProductCategoryWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ await linkSellersToProductCategoryWorkflow(container).run({
14
+ input: {
15
+ id: "pcat_01H...",
16
+ add: ["sel_01H..."],
17
+ remove: ["sel_01J..."],
18
+ },
19
+ })
20
+ ```
21
+
22
+ ## Input
23
+
24
+ <ParamField body="id" type="string" required>
25
+ Id of the product category whose seller links are being updated.
26
+ </ParamField>
27
+
28
+ <ParamField body="add" type="string[]">
29
+ Seller ids to link to the category.
30
+ </ParamField>
31
+
32
+ <ParamField body="remove" type="string[]">
33
+ Seller ids to unlink from the category.
34
+ </ParamField>
35
+
36
+ ## Result
37
+
38
+ <ResponseField name="result" type="void">
39
+ Returns nothing; the links are created and removed in place.
40
+ </ResponseField>
@@ -0,0 +1,40 @@
1
+ ---
2
+ title: "linkSellersToProductWorkflow"
3
+ description: "Add or remove seller eligibility links on a master product."
4
+ ---
5
+
6
+ Updates which sellers are eligible for a master product by creating and removing `product_seller` links in one call. Triggered by `POST /admin/products/:id/sellers`. No events are emitted and the product record itself is untouched.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { linkSellersToProductWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ await linkSellersToProductWorkflow(container).run({
14
+ input: {
15
+ id: "prod_01H...",
16
+ add: ["sel_01H..."],
17
+ remove: ["sel_01J..."],
18
+ },
19
+ })
20
+ ```
21
+
22
+ ## Input
23
+
24
+ <ParamField body="id" type="string" required>
25
+ Id of the product whose seller links are being updated.
26
+ </ParamField>
27
+
28
+ <ParamField body="add" type="string[]">
29
+ Seller ids to link to the product.
30
+ </ParamField>
31
+
32
+ <ParamField body="remove" type="string[]">
33
+ Seller ids to unlink from the product.
34
+ </ParamField>
35
+
36
+ ## Result
37
+
38
+ <ResponseField name="result" type="void">
39
+ Returns nothing; the links are created and removed in place.
40
+ </ResponseField>
@@ -0,0 +1,46 @@
1
+ ---
2
+ title: "rejectProductWorkflow"
3
+ description: "Reject a proposed product submission with an optional message to the vendor."
4
+ ---
5
+
6
+ Rejects a product awaiting review: validates the product is in `proposed` status, sets it to `rejected`, and records a confirmed `STATUS_CHANGE` audit action whose `external_note` carries the rejection message. Triggered by `POST /admin/products/:id/reject`. Emits `product.rejected` with `{ id, message }`.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { rejectProductWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ await rejectProductWorkflow(container).run({
14
+ input: {
15
+ product_id: "prod_01H...",
16
+ message: "Images do not meet marketplace guidelines",
17
+ actor_id: "user_01H...",
18
+ },
19
+ })
20
+ ```
21
+
22
+ ## Input
23
+
24
+ <ParamField body="product_id" type="string" required>
25
+ Id of the product to reject. Must currently be in `proposed` status.
26
+ </ParamField>
27
+
28
+ <ParamField body="message" type="string">
29
+ Vendor-facing rejection reason, stored as the audit change's `external_note` and included in the emitted event.
30
+ </ParamField>
31
+
32
+ <ParamField body="actor_id" type="string">
33
+ Actor id recorded on the audit trail entry.
34
+ </ParamField>
35
+
36
+ ## Result
37
+
38
+ <ResponseField name="result" type="void">
39
+ Returns nothing; the product status is updated in place.
40
+ </ResponseField>
41
+
42
+ ## Hooks
43
+
44
+ <ResponseField name="productRejected" type="hook">
45
+ Runs after rejection with `{ product_id, message }`.
46
+ </ResponseField>
@@ -0,0 +1,46 @@
1
+ ---
2
+ title: "requestProductChangeWorkflow"
3
+ description: "Ask a vendor to revise a proposed product submission without changing its status."
4
+ ---
5
+
6
+ Records an operator's request for revisions on a product awaiting review. Validates the product is in `proposed` status and records a confirmed `CHANGE_REQUESTED` audit action — the product itself is not mutated; the audit entry and its `external_note` are the durable signal to the vendor. Triggered by `POST /admin/products/:id/request-changes`. Emits `product.change-requested` with `{ id, message, actor_id }`.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { requestProductChangeWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ await requestProductChangeWorkflow(container).run({
14
+ input: {
15
+ product_id: "prod_01H...",
16
+ message: "Please add care instructions to the description",
17
+ actor_id: "user_01H...",
18
+ },
19
+ })
20
+ ```
21
+
22
+ ## Input
23
+
24
+ <ParamField body="product_id" type="string" required>
25
+ Id of the product to request changes on. Must currently be in `proposed` status.
26
+ </ParamField>
27
+
28
+ <ParamField body="message" type="string">
29
+ Vendor-facing revision request, stored as the audit change's `external_note` and in the action's `details.message`.
30
+ </ParamField>
31
+
32
+ <ParamField body="actor_id" type="string">
33
+ Actor id recorded on the audit trail entry.
34
+ </ParamField>
35
+
36
+ ## Result
37
+
38
+ <ResponseField name="result" type="void">
39
+ Returns nothing; only an audit entry is created.
40
+ </ResponseField>
41
+
42
+ ## Hooks
43
+
44
+ <ResponseField name="productChangeRequested" type="hook">
45
+ Runs after the audit entry is recorded with `{ product_id, message }`.
46
+ </ResponseField>
@@ -0,0 +1,49 @@
1
+ ---
2
+ title: "addProductAttributesToProductWorkflow"
3
+ description: "Attach existing or inline attributes (and their values) to a product."
4
+ ---
5
+
6
+ Handles the `add` portion of the attribute batch engine (`createAndLinkProductAttributesToProductWorkflow`). Existing `text`/`unit` attributes get a new value created from `value`; `toggle` links the seeded `true`/`false` value; existing variant-axis `multi_select` attributes have their mirror `ProductOption` attached to the product with the selected value subset. Inline refs create a product-scoped attribute — axis refs also create an exclusive `ProductOption` — and link the values to the product.
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { addProductAttributesToProductWorkflow } from "@mercurjs/core/workflows"
12
+
13
+ await addProductAttributesToProductWorkflow(container).run({
14
+ input: {
15
+ product_id: "prod_123",
16
+ add: [
17
+ { id: "pattr_material", value: "Cotton" },
18
+ { title: "Size", values: ["S", "M", "L"], is_variant_axis: true },
19
+ ],
20
+ },
21
+ })
22
+ ```
23
+
24
+ Also accepts an array of `{ product_id, add }` items to process several products in one run.
25
+
26
+ ## Input
27
+
28
+ <ParamField body="product_id" type="string" required>The product to attach the attributes to.</ParamField>
29
+ <ParamField body="add" type="ProductAttributeBatchAdd[]" required>
30
+ Attribute refs to attach.
31
+ <Expandable title="properties">
32
+ <ParamField body="id" type="string">Id of an existing attribute (existing form).</ParamField>
33
+ <ParamField body="value_ids" type="string[]">Attribute value ids to link (select types / axis subset).</ParamField>
34
+ <ParamField body="value" type="string | number | boolean">Scalar for `text` / `unit` / `toggle` attributes.</ParamField>
35
+ <ParamField body="title" type="string">Name of the inline attribute to create (inline form).</ParamField>
36
+ <ParamField body="type" type="AttributeType">One of `single_select`, `multi_select`, `unit`, `toggle`, `text`; inferred when omitted (`is_variant_axis` ⇒ `multi_select`, boolean `value` ⇒ `toggle`, else `text`).</ParamField>
37
+ <ParamField body="values" type="string[]">Value names to create for inline multi-value attributes.</ParamField>
38
+ <ParamField body="is_variant_axis" type="boolean">Create the inline attribute as a variant axis with an exclusive product option.</ParamField>
39
+ <ParamField body="is_filterable" type="boolean">Whether the inline attribute is filterable. Defaults to `false`.</ParamField>
40
+ <ParamField body="is_required" type="boolean">Whether the inline attribute is required. Defaults to `false`.</ParamField>
41
+ <ParamField body="description" type="string | null">Description of the inline attribute.</ParamField>
42
+ <ParamField body="metadata" type="object | null">Custom key-value data on the inline attribute.</ParamField>
43
+ </Expandable>
44
+ </ParamField>
45
+ <ParamField body="additional_data" type="object">Custom data passed through.</ParamField>
46
+
47
+ ## Result
48
+
49
+ <ResponseField name="result" type="void">No return value.</ResponseField>