Edit in GitHubLog an issue
Thanks to Atwix for contributing this topic!

Step 5. Set billing address

Use the setBillingAddressOnCart mutation to set a billing address.

Add a billing address to the cart

Similar to the shipping address, add a billing address to the cart. { CART_ID } is the unique shopping cart ID from Step 2. Create empty cart. The street address is also different, so we can see that different addresses are being created.

Send the customer's authorization token in the Authorization parameter of the header. See Authorization tokens for more information.

Request:

Copied to your clipboard
mutation {
setBillingAddressOnCart(
input: {
cart_id: "{ CART_ID }"
billing_address: {
address: {
firstname: "John"
lastname: "Doe"
company: "Company Name"
street: ["64 Strawberry Dr", "Beverly Hills"]
city: "Los Angeles"
region: "CA"
region_id: 12
postcode: "90210"
country_code: "US"
telephone: "123-456-0000"
save_in_address_book: true
}
}
}
) {
cart {
billing_address {
firstname
lastname
company
street
city
region{
code
label
}
postcode
telephone
country {
code
label
}
}
}
}
}

Response:

Copied to your clipboard
{
"data": {
"setBillingAddressOnCart": {
"cart": {
"billing_address": {
"firstname": "John",
"lastname": "Doe",
"company": "Company Name",
"street": [
"64 Strawberry Dr",
"Beverly Hills"
],
"city": "Los Angeles",
"region": {
"code": "CA",
"label": "California"
},
"postcode": "90210",
"telephone": "123-456-0000",
"country": {
"code": "US",
"label": "US"
}
}
}
}
}
}

Verify this step

  1. Sign in as a customer to the website using the email john.doe@example.com and password b1b2b3l@w+.

  2. Go to Checkout.

  3. Go to the Review & Payments step. The Billing Address form is populated with the address details you entered.

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.