Open
Description
Preconditions and environment
- Magento 2.4.5-p1
- GraphQL modules are enabled
Steps to reproduce
- Create an empty cart as guest
mutation {
createEmptyCart
}
- Create a customer account (don't login yet)
mutation {
createCustomerV2(input: { firstname: "foo", lastname: "bar", email: "[email protected]", password: "foobar123" }) {
customer {
firstname
lastname
}
}
}
- Add a product to the cart
mutation($cartId: String!) {
addProductsToCart(cartId: $cartId, cartItems: { sku: "1234", quantity: 1 }) {
cart {
id
}
}
}
- Set a shipping address with
save_in_address_book: true
on the cart
mutation($cartId: String!) {
setShippingAddressesOnCart(
input: {
cart_id: $cartId
shipping_addresses: [
{
address: {
firstname: "foo"
lastname: "bar"
telephone: "0987654321"
street: ["Foobar 12"]
region: "Groningen"
postcode: "1234"
city: "Groningen",
country_code: "NL",
save_in_address_book: true
}
}
]
}
) {
cart {
id
}
}
}
- Set a different billing address with
save_in_address_book: true
on the cart
mutation($cartId: String!) {
setBillingAddressOnCart(
input: {
cart_id: $cartId
billing_address: {
address: {
firstname: "bar"
lastname: "foo"
telephone: "0987654321"
street: ["Wefwef 94"]
region: "Groningen"
postcode: "9876"
city: "Groningen"
country_code: "NL"
save_in_address_book: true
}
}
}
) {
cart {
id
}
}
}
- Generate a customer token for the account created in step 2
mutation GenerateCustomerToken {
generateCustomerToken(password: "foobar123", email: "[email protected]") {
token
}
}
- Run the assignCustomerToGuestCart mutation, attaching the cart to the customer
Header: Authorization: Bearer <token from step 6>
mutation($cartId: String!) {
assignCustomerToGuestCart(cart_id: $cartId) {
id
}
}
Expected result
Before placing the order, the following query should show same_as_billing: 0
both before and after the assignCustomerToGuestCart
mutation for the shipping address:
select save_in_address_book, address_type, same_as_billing from quote_address where quote_id = <quoteId>\G
*************************** 1. row ***************************
save_in_address_book: 1
address_type: shipping
same_as_billing: 0
*************************** 2. row ***************************
save_in_address_book: 1
address_type: billing
same_as_billing: 0
After placing the order, both the shipping and billing addresses are added to the customer's address book.
Actual result
Before placing the order, the following query shows same_as_billing: 1
after the assignCustomerToGuestCart
mutation for the shipping address:
select save_in_address_book, address_type, same_as_billing from quote_address where quote_id = <quoteId>\G
*************************** 1. row ***************************
save_in_address_book: 1
address_type: shipping
same_as_billing: 1
*************************** 2. row ***************************
save_in_address_book: 1
address_type: billing
same_as_billing: 0
After placing the order, only the billing addresses is added to the customer's address book.
Additional information
A workaround for the issue for now it to call setShippingAddressOnCart
a second time after the assignCustomerToGuestCart
mutation
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.