You can manage the Guest cart billing address for the current quote of the guest customers in Magento 2 with the help of REST API.
You can use the given Rest URL to set and get the Billing address of the Guest cart.
/V1/guest-carts/:cartId/billing-address
If you want to assign a billing address to a specific cart, You can use the POST method to set the billing address on the current guest cart,
I hope you have available Guest cart token to use in our API request.
- Request URL: <URL>/V1/guest-carts/:cartId/billing-address
(Example: https://magento.test.com/rest/V1/guest-carts/tYqIEtiDdGx2Jw9MAyzR7FP9tx6ruD4b/billing-address)
- Action: POST
- Request Payload:
{
"address": {
"region": "",
"country_id": "GB",
"street": [
"West road"
],
"postcode": "W1S 1LA",
"city": "London",
"firstname": "Rakesh",
"lastname": "Patel",
"email": "rakesh@jesadiya.com",
"telephone": "04422531111"
}
}
Response: Quote Billing Address ID (101)
In the above Request URL, If you use the Action method as GET, you can fetch the available guest cart billing address.
Thank you.