Get Estimate Shipping method for a guest customer in Magento via V1/guest-carts/:cartId/estimate-shipping-methods REST API.
To fetch current guest customer quote shipping methods, you need to pass the address of the customer, once you add the payload as the address for the current quote, the available shipping method will be displayed in the result.
Action: POST
URL: <WEBSITE_URL>/rest/<STORE_CODE>/V1/guest-carts/:cartId/estimate-shipping-methods
(Example: https://magento.test/rest/default/V1/guest-carts/fQtl1bxLdxud1fFEP68znOAPnAFFpjVh/estimate-shipping-methods)
Payload:
{ "address": { "region": "California", "region_id": "12", "country_id": "US", "street": [ "34 Royal Street" ], "postcode": "45454", "city": "California", "firstname": "Rakesh", "lastname": "Patel", "email": "rakesh@jesadiya.com", "telephone": "4422531111" } }
Response:
[ { "carrier_code": "flatrate", "method_code": "flatrate", "carrier_title": "Flat Rate", "method_title": "Fixed", "amount": 10, "base_amount": 10, "available": true, "error_message": "", "price_excl_tax": 10, "price_incl_tax": 10 } ]
In the Response of the API, you will get the array of shipping methods for the current address.
Here we will be able to see flatrate shipping method for the quote. You can use this carrier code and method code to the V1/guest-carts/:cartId/shipping-information