5

STEP 1 - Using REST API I created a customer,And in address data I passed default shipping and billing true

  • "defaultShipping": true,
  • "defaultBilling": true,

STEP 2 - In GET customer detail API it returns true value for defaultShipping and defaultBilling

STEP 3 - But when I fetch the shipping methods using rest/V1/carts/mine/shipping-methods API to place and Order it return me the error

"message": "Shipping address not set."

So Magento 2 REST API is not fetching defaultShipping address value.

And I need to add shipping address every time whenever I place a new order to fetch shipping methods and charge with this API.

POST http://host/rest/V1/carts/mine/estimate-shipping-methods

Is there any Alternate solution available to pass defaultShipping address data to get shipping-methods and shipping-charge without adding new address every time I place a new order ?

4

Magento 2 have API - which we can select from existing address from customer account addresses API, so customer don't need to add address every time whenever he/she places a new order.

quoteShippingMethodManagementV1

Interface ShippingMethodManagementInterface

POST /V1/carts/mine/estimate-shipping-methods-by-address-id

Data

{
  "addressId": 0
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.