File tree Expand file tree Collapse file tree 2 files changed +11
-22
lines changed
modules/checkout/templates/checkout-form Expand file tree Collapse file tree 2 files changed +11
-22
lines changed Original file line number Diff line number Diff line change @@ -199,22 +199,11 @@ export const retrieveOrder = cache(async function (id: string) {
199
199
} )
200
200
201
201
// Shipping actions
202
- export const listShippingMethods = cache ( async function listShippingMethods (
203
- regionId : string ,
204
- productIds ?: string [ ]
205
- ) {
202
+ export const listCartShippingMethods = cache ( async function ( cartId : string ) {
206
203
const headers = getMedusaHeaders ( [ "shipping" ] )
207
204
208
- const product_ids = productIds ?. join ( "," )
209
-
210
205
return medusaClient . shippingOptions
211
- . list (
212
- {
213
- region_id : regionId ,
214
- product_ids,
215
- } ,
216
- headers
217
- )
206
+ . listCartOptions ( cartId , headers )
218
207
. then ( ( { shipping_options } ) => shipping_options )
219
208
. catch ( ( err ) => {
220
209
console . log ( err )
Original file line number Diff line number Diff line change 1
- import Addresses from "@modules/checkout/components/addresses"
2
- import Shipping from "@modules/checkout/components/shipping"
3
- import Payment from "@modules/checkout/components/payment"
4
- import Review from "@modules/checkout/components/review"
5
1
import {
6
2
createPaymentSessions ,
7
3
getCustomer ,
8
- listShippingMethods ,
4
+ listCartShippingMethods ,
9
5
} from "@lib/data"
6
+ import { getCheckoutStep } from "@lib/util/get-checkout-step"
7
+ import Addresses from "@modules/checkout/components/addresses"
8
+ import Payment from "@modules/checkout/components/payment"
9
+ import Review from "@modules/checkout/components/review"
10
+ import Shipping from "@modules/checkout/components/shipping"
10
11
import { cookies } from "next/headers"
11
12
import { CartWithCheckoutStep } from "types/global"
12
- import { getCheckoutStep } from "@lib/util/get-checkout-step"
13
13
14
14
export default async function CheckoutForm ( ) {
15
15
const cartId = cookies ( ) . get ( "_medusa_cart_id" ) ?. value
@@ -30,9 +30,9 @@ export default async function CheckoutForm() {
30
30
cart . checkout_step = cart && getCheckoutStep ( cart )
31
31
32
32
// get available shipping methods
33
- const availableShippingMethods = await listShippingMethods (
34
- cart . region_id
35
- ) . then ( ( methods ) => methods ?. filter ( ( m ) => ! m . is_return ) )
33
+ const availableShippingMethods = await listCartShippingMethods ( cart . id ) . then (
34
+ ( methods ) => methods ?. filter ( ( m ) => ! m . is_return )
35
+ )
36
36
37
37
if ( ! availableShippingMethods ) {
38
38
return null
You can’t perform that action at this time.
0 commit comments