diff --git a/packages/core/js-sdk/src/store/index.ts b/packages/core/js-sdk/src/store/index.ts index 64d315252e..f5d28ba20e 100644 --- a/packages/core/js-sdk/src/store/index.ts +++ b/packages/core/js-sdk/src/store/index.ts @@ -941,6 +941,36 @@ 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 = { diff --git a/packages/core/types/src/http/cart/store/payloads.ts b/packages/core/types/src/http/cart/store/payloads.ts index 02c7bd743a..d36ca9382d 100644 --- a/packages/core/types/src/http/cart/store/payloads.ts +++ b/packages/core/types/src/http/cart/store/payloads.ts @@ -71,6 +71,8 @@ export interface StoreUpdateCart { promo_codes?: string[] } +export interface StoreUpdateCartCustomer {} + export interface StoreAddCartLineItem { /** * The ID of the product variant to add to the cart. @@ -104,7 +106,7 @@ export interface StoreAddCartShippingMethods { option_id: string /** * Data useful for the associated fulfillment provider. - * + * * Learn more in [this documentation](https://docs.medusajs.com/resources/commerce-modules/fulfillment/shipping-option#data-property). */ data?: Record