createOrderExchangesStep - Medusa Core Workflows Reference

This documentation provides a reference to the createOrderExchangesStep. It belongs to the @medusajs/medusa/core-flows package.

This step creates one or more order exchanges.

src/workflows/my-workflow.ts
1import { createWorkflow } from "@medusajs/framework/workflows-sdk"2import { createOrderExchangesStep } from "@medusajs/medusa/core-flows"3
4const myWorkflow = createWorkflow(5  "my-workflow",6  () => {7    const data = createOrderExchangesStep([{8      "order_id": "order_123"9    }])10  }11)

Input#

CreateOrderExchangeDTO[]CreateOrderExchangeDTO[]
order_idstring
The associated order's ID.
return_idstringOptional
The associated return's ID.
claim_idstringOptional
The associated claim's ID.
exchange_idstringOptional
The associated exchange's ID.
descriptionstringOptional
The description of the action.
internal_notestringOptional
The internal note of the action.
referencestringOptional
The name of the data model the action references. For example, return.
reference_idstringOptional
The ID of the record of the data model specified in reference. For example, if reference is return, the value is return_123.
metadatanull | Record<string, unknown>Optional
Holds custom data in key-value pairs.
additional_itemsBaseOrderBundledItemActionsDTO[]Optional
The items to be sent to the customer.
shipping_methodsstring[] | Omit<CreateOrderShippingMethodDTO, "order_id">[]Optional
The shipping methods used to send the additional items to the customer.
return_shippingstring | Omit<CreateOrderShippingMethodDTO, "order_id">Optional
The shipping methods used to return items from the customer.
difference_dueBigNumberInputOptional
The difference due of the exchange.
  • If less than 0, the merchant owes the customer this amount.
  • If greater than 0, the customer owes the merchange this amount.
  • If equal to 0, no payment is required by either sides.
allow_backorderbooleanOptional
Whether backorder is allowed for the exchange's items.
no_notificationbooleanOptional
Whether the customer should receive notifications related to updates on the exchange.
created_bynull | stringOptional
The id of the user that creates the order exchange

Output#

OrderExchangeDTO[]OrderExchangeDTO[]
idstring
The exchange's ID.
order_idstring
The associated order's ID.
order_versionnumber
The version of the order when the exchange is applied.
display_idnumber
The exchange's display ID.
additional_itemsany[]
The items to be sent to the customer.
metadatanull | Record<string, unknown>
Holds custom data in key-value pairs.
orderOrderDTOOptional
The associated order.
no_notificationbooleanOptional
Whether the customer should receive notifications related to updates on the exchange.
difference_dueBigNumberValueOptional
The difference due of the order exchange.
  • If less than 0, the merchant owes the customer this amount.
  • If greater than 0, the customer owes the merchange this amount.
  • If equal to 0, no payment is required by either sides.
raw_difference_dueBigNumberValueOptional
The raw difference due of the order exchange.
  • If less than 0, the merchant owes the customer this amount.
  • If greater than 0, the customer owes the merchange this amount.
  • If equal to 0, no payment is required by either sides.
allow_backorderbooleanOptional
Whether the variants that are out of stock can be added to the exchange.
returnReturnDTOOptional
The associated return.
return_idstringOptional
The associated return's ID.
created_bynull | stringOptional
The id of the user that created the order exchange
shipping_methodsOrderShippingMethodDTO[]Optional
The shipping methods used to send the additional items.
transactionsOrderTransactionDTO[]Optional
The exchange's transactions if additional payment is required.
created_atstring | DateOptional
The creation date of the exchange.
updated_atstring | DateOptional
The update date of the exchange.
deleted_atstring | DateOptional
The deletion date of the exchange.
canceled_atstring | DateOptional
The cancelation date of the exchange.
Was this page helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break