diff --git a/.changeset/gorgeous-knives-march.md b/.changeset/gorgeous-knives-march.md new file mode 100644 index 0000000000..9a3d73b7a4 --- /dev/null +++ b/.changeset/gorgeous-knives-march.md @@ -0,0 +1,5 @@ +--- +"@medusajs/js-sdk": patch +--- + +feat(js-sdk): add transferCart to sdk -> store -> cart diff --git a/packages/core/js-sdk/src/store/index.ts b/packages/core/js-sdk/src/store/index.ts index f5d28ba20e..78e0f9c79f 100644 --- a/packages/core/js-sdk/src/store/index.ts +++ b/packages/core/js-sdk/src/store/index.ts @@ -771,6 +771,35 @@ export class Store { } ) }, + + /** + * This method updates the customer of a cart. + * + * @param id - The cart's ID. + * @param query - Configure the fields to retrieve in the cart. + * @param headers - Headers to pass in the request. + * @returns The updated cart. + * + * @example + * sdk.store.cart.transferCart("cart_123") + * .then(({ cart }) => { + * console.log(cart) + * }) + */ + transferCart: async ( + id: string, + query?: SelectParams, + headers?: ClientHeaders + ) => { + return this.client.fetch( + `/store/carts/${id}/customer`, + { + method: "POST", + headers, + query, + } + ) + }, } public fulfillment = { @@ -941,36 +970,6 @@ export class Store { } ) }, - - /** - * This method updates the customer of a cart. - * - * @param id - The cart's ID. - * @param body - The data to update in the cart. - * @param query - Configure the fields to retrieve in the cart. - * @param headers - Headers to pass in the request. - * @returns The updated cart. - * - * @example - * sdk.store.cart.transferCart("cart_123") - * .then(({ cart }) => { - * console.log(cart) - * }) - */ - transferCart: async ( - id: string, - query?: SelectParams, - headers?: ClientHeaders - ) => { - return this.client.fetch( - `/store/carts/${id}/customer`, - { - method: "POST", - headers, - query, - } - ) - }, } public order = {