Skip to content

Commit 6680f69

Browse files
authored
fix: move transfer cart under cart (medusajs#10175)
made a whoopsie!
1 parent 1185be3 commit 6680f69

File tree

2 files changed

+34
-30
lines changed

2 files changed

+34
-30
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@medusajs/js-sdk": patch
3+
---
4+
5+
feat(js-sdk): add transferCart to sdk -> store -> cart

packages/core/js-sdk/src/store/index.ts

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,35 @@ export class Store {
771771
}
772772
)
773773
},
774+
775+
/**
776+
* This method updates the customer of a cart.
777+
*
778+
* @param id - The cart's ID.
779+
* @param query - Configure the fields to retrieve in the cart.
780+
* @param headers - Headers to pass in the request.
781+
* @returns The updated cart.
782+
*
783+
* @example
784+
* sdk.store.cart.transferCart("cart_123")
785+
* .then(({ cart }) => {
786+
* console.log(cart)
787+
* })
788+
*/
789+
transferCart: async (
790+
id: string,
791+
query?: SelectParams,
792+
headers?: ClientHeaders
793+
) => {
794+
return this.client.fetch<HttpTypes.StoreCartResponse>(
795+
`/store/carts/${id}/customer`,
796+
{
797+
method: "POST",
798+
headers,
799+
query,
800+
}
801+
)
802+
},
774803
}
775804

776805
public fulfillment = {
@@ -941,36 +970,6 @@ export class Store {
941970
}
942971
)
943972
},
944-
945-
/**
946-
* This method updates the customer of a cart.
947-
*
948-
* @param id - The cart's ID.
949-
* @param body - The data to update in the cart.
950-
* @param query - Configure the fields to retrieve in the cart.
951-
* @param headers - Headers to pass in the request.
952-
* @returns The updated cart.
953-
*
954-
* @example
955-
* sdk.store.cart.transferCart("cart_123")
956-
* .then(({ cart }) => {
957-
* console.log(cart)
958-
* })
959-
*/
960-
transferCart: async (
961-
id: string,
962-
query?: SelectParams,
963-
headers?: ClientHeaders
964-
) => {
965-
return this.client.fetch<HttpTypes.StoreCartResponse>(
966-
`/store/carts/${id}/customer`,
967-
{
968-
method: "POST",
969-
headers,
970-
query,
971-
}
972-
)
973-
},
974973
}
975974

976975
public order = {

0 commit comments

Comments
 (0)