diff --git a/src/data/navigation/sections/graphql.js b/src/data/navigation/sections/graphql.js index 64350c272..a60fab381 100644 --- a/src/data/navigation/sections/graphql.js +++ b/src/data/navigation/sections/graphql.js @@ -583,6 +583,10 @@ module.exports = [ title: "deleteCustomerAddress", path: "/graphql/schema/customer/mutations/delete-address/", }, + { + title: "deleteCustomerAddressV2", + path: "/graphql/schema/customer/mutations/delete-address-v2/", + }, { title: "exchangeExternalCustomerToken", path: "/graphql/schema/customer/mutations/exchange-external-customer-token/", @@ -631,6 +635,10 @@ module.exports = [ title: "updateCustomerAddress", path: "/graphql/schema/customer/mutations/update-address/", }, + { + title: "updateCustomerAddressV2", + path: "/graphql/schema/customer/mutations/update-address-v2/", + }, { title: "updateCustomerEmail", path: "/graphql/schema/customer/mutations/update-email/", diff --git a/src/pages/graphql/schema/customer/mutations/delete-address-v2.md b/src/pages/graphql/schema/customer/mutations/delete-address-v2.md new file mode 100644 index 000000000..b24b72be9 --- /dev/null +++ b/src/pages/graphql/schema/customer/mutations/delete-address-v2.md @@ -0,0 +1,85 @@ +--- +title: deleteCustomerAddressV2 mutation +--- + +# deleteCustomerAddressV2 mutation + +Use the `deleteCustomerAddressV2` mutation to delete the specified customer address. It returns a Boolean value that indicates whether the operation was successful. + +We recommend you use a customer token in the header of your call to delete a customer. However, you also can use [session authentication](https://developer.adobe.com/commerce/webapi/get-started/authentication/gs-authentication-session). + + + +This mutation is part of the [Storefront Compatibility Package](https://experienceleague.adobe.com/developer/commerce/storefront/setup/configuration/storefront-compatibility/v248/). It will be added to Adobe Commerce 2.4.9. + +## Syntax + +```graphql +mutation { + deleteCustomerAddressV2( + uid: ID! + ) { + Boolean + } +} +``` + + + +## Example usage + +The following call deletes a customer's address. + +**Request:** + +```graphql +mutation { + deleteCustomerAddressV2(uid: "ODU=") +} +``` + +**Response:** + +```json +{ + "data": { + "deleteCustomerAddressV2": true + } +} +``` + +## Input attributes + +The `deleteCustomerAddressV2` mutation requires the following input: + +Attribute | Data Type | Description +--- | --- | --- +`uid` | ID! | The unique ID for a `CustomerAddress` object. + +## Output attributes + +The `deleteCustomerAddressV2` mutation returns a Boolean value that indicates whether the operation was successful. + +## Errors + +Error | Description +--- | --- +`Address "uid" value must be specified` | The `uid` argument is null or empty. +`Could not find an address with ID "XXX"` | The customer address specified in the `uid` argument does not exist. +`Customer Address XXX is set as default billing address and cannot be deleted` | You cannot delete a default billing address. +`Customer Address XXX is set as default shipping address and cannot be deleted` | You cannot delete a default shipping address. +`Field "deleteCustomerAddressV2" argument "uid" requires type ID!, found "XXX".` | The specified `uid` argument value has the wrong type. +`Syntax Error: Expected Name, found )` | The `uid` argument was omitted or does not have a value. +`The current customer isn't authorized.` | The current customer is not currently logged in, or the customer's token does not exist in the `oauth_token` table. + +## Related topics + +* [customer query](../queries/customer.md) +* [createCustomer mutation](create.md) +* [updateCustomer mutation](update.md) +* [createCustomerAddress mutation](create-address.md) +* [updateCustomerAddress mutation](update-address.md) diff --git a/src/pages/graphql/schema/customer/mutations/delete-address.md b/src/pages/graphql/schema/customer/mutations/delete-address.md index c9afbb158..948be1ab3 100644 --- a/src/pages/graphql/schema/customer/mutations/delete-address.md +++ b/src/pages/graphql/schema/customer/mutations/delete-address.md @@ -4,6 +4,10 @@ title: deleteCustomerAddress mutation # deleteCustomerAddress mutation + + +This mutation has been deprecated in Adobe Commerce as a Cloud Service and will be deprecated in Adobe Commerce 2.4.9. We recommend using the [deleteCustomerAddressV2 mutation](./delete-address-v2.md) instead. + Use the `deleteCustomerAddress` mutation to delete the specified customer address. It returns a Boolean value that indicates whether the operation was successful. We recommend you use a customer token in the header of your call to delete a customer. However, you also can use [session authentication](https://developer.adobe.com/commerce/webapi/get-started/authentication/gs-authentication-session). diff --git a/src/pages/graphql/schema/customer/mutations/index.md b/src/pages/graphql/schema/customer/mutations/index.md index b7bba4765..cd6f977c3 100644 --- a/src/pages/graphql/schema/customer/mutations/index.md +++ b/src/pages/graphql/schema/customer/mutations/index.md @@ -13,8 +13,10 @@ The customer mutations allow you to perform the following operations: * [`createCustomerAddress`](create-address.md) * [`createCustomerV2`](create-v2.md) * [`deleteCustomerAddress`](delete-address.md) + * [`deleteCustomerAddressV2`](delete-address-v2.md) * [`updateCustomer`](update.md) * [`updateCustomerAddress`](update-address.md) + * [`updateCustomerAddressV2`](update-address-v2.md) * [`updateCustomerEmail`](update-email.md) * [`updateCustomerV2`](update-v2.md) diff --git a/src/pages/graphql/schema/customer/mutations/update-address-v2.md b/src/pages/graphql/schema/customer/mutations/update-address-v2.md new file mode 100644 index 000000000..72ddcb1f8 --- /dev/null +++ b/src/pages/graphql/schema/customer/mutations/update-address-v2.md @@ -0,0 +1,164 @@ +--- +title: updateCustomerAddressV2 mutation +--- + +# updateCustomerAddressV2 mutation + +Use the `updateCustomerAddressV2` mutation to update the customer's address. + +To return or modify information about a customer, we recommend you use customer tokens in the header of your GraphQL calls. However, you also can use [session authentication](https://developer.adobe.com/commerce/webapi/get-started/authentication/gs-authentication-session). + + + +This mutation is part of the [Storefront Compatibility Package](https://experienceleague.adobe.com/developer/commerce/storefront/setup/configuration/storefront-compatibility/v248/). It will be added to Adobe Commerce 2.4.9. + +## Syntax + +```graphql +mutation { + updateCustomerAddressV2( + uid: ID!, + input: CustomerAddressInput + ) { + CustomerAddress + } +} +``` + + + +## Example usage + +### Update a customer address + +The following call updates the customer's city and postcode. + +**Request:** + +```graphql +mutation { + updateCustomerAddressV2(uid:"ODU=", input: { + city: "New City" + postcode: "55555" + }) { + uid + city + postcode + } +} +``` + +**Response:** + +```json +{ + "data": { + "updateCustomerAddressV2": { + "uid": "ODU=", + "city": "New City", + "postcode": 55555 + } + } +} +``` + +### Update a customer address with custom attributes + +The following call updates the customer's city, postcode, and custom attributes. The merchant has previously created the `station` and `services` attributes for customer addresses. + +**Request:** + +```graphql +mutation { + updateCustomerAddressV2(uid: "ODU=", input: { + city: "New City" + postcode: "55555" + custom_attributesV2: [ + { + attribute_code: "station", + value: "Times Sq - 42 St" + }, + { + attribute_code: "services" + value: "507" + selected_options: [ + { + uid: "NTA3" + value: "507" + } + ] + } + ] + }) { + uid + city + postcode + custom_attributesV2 { + code + ... on AttributeValue { + value + } + ... on AttributeSelectedOptions { + selected_options { + label + value + } + } + } + } +} +``` + +**Response:** + +```json +{ + "data": { + "updateCustomerAddressV2": { + "uid": "ODU=", + "city": "New City", + "postcode": 55555, + "custom_attributesV2": [ + { + "code": "station", + "value": "Times Sq - 42 St" + }, + { + "code": "services", + "selected_options": [ + { + "label": "hospital", + "value": "507" + } + ] + } + ] + } + } +} +``` + +## Errors + +Error | Description +--- | --- +`Address "uid" value must be specified` | The `uid` argument is null or empty. +`Could not find an address with ID "XXX"` | The customer address specified in the `uid` argument does not exist. +`Current customer does not have permission to address with ID "XXX"` | The customer tries to update the address of another customer. +`Field "updateCustomerAddressV2" argument "uid" of type "ID!" is required but not provided.` | The `uid` argument was omitted. +`Field "updateCustomerAddressV2" argument "uid" requires type ID!, found "XXX".` | The specified `uid` argument value has the wrong type. +`"input" value must be specified` | The `input` argument was omitted or was specified but is empty. +`Syntax Error: Expected Name, found )` | The `uid` and `input` arguments are omitted. +`The current customer isn't authorized.` | The current customer is not currently logged in, or the customer's token does not exist in the `oauth_token` table. + +## Related topics + +* [customer query](../queries/customer.md) +* [createCustomer mutation](create.md) +* [updateCustomer mutation](update.md) +* [createCustomerAddress mutation](create-address.md) +* [deleteCustomerAddress mutation](delete-address.md) diff --git a/src/pages/graphql/schema/customer/mutations/update-address.md b/src/pages/graphql/schema/customer/mutations/update-address.md index f16a757ee..08e1ca4d9 100644 --- a/src/pages/graphql/schema/customer/mutations/update-address.md +++ b/src/pages/graphql/schema/customer/mutations/update-address.md @@ -4,6 +4,10 @@ title: updateCustomerAddress mutation # updateCustomerAddress mutation + + +This mutation has been deprecated in Adobe Commerce as a Cloud Service and will be deprecated in Adobe Commerce 2.4.9. We recommend using the [`updateCustomerAddressV2` mutation](./update-address-v2.md) instead. + Use the `updateCustomerAddress` mutation to update the customer's address. To return or modify information about a customer, we recommend you use customer tokens in the header of your GraphQL calls. However, you also can use [session authentication](https://developer.adobe.com/commerce/webapi/get-started/authentication/gs-authentication-session). diff --git a/src/pages/graphql/schema/orders/queries/guest-order-by-token.md b/src/pages/graphql/schema/orders/queries/guest-order-by-token.md index 0d9400806..e3787a5a5 100644 --- a/src/pages/graphql/schema/orders/queries/guest-order-by-token.md +++ b/src/pages/graphql/schema/orders/queries/guest-order-by-token.md @@ -13,7 +13,7 @@ You can retrieve the token from the `CustomerOrder` object on the [`placeOrder` ## Reference -The `guestOrderByToken` reference provides detailed information about the types and fields defined in this query. +The [`guestOrderByToken`](https://developer.adobe.com/commerce/webapi/graphql-api/index.html#query-guestOrderByToken) reference provides detailed information about the types and fields defined in this query. ## Example usage diff --git a/src/pages/graphql/schema/orders/queries/guest-order.md b/src/pages/graphql/schema/orders/queries/guest-order.md index 809242017..b2e5000f4 100644 --- a/src/pages/graphql/schema/orders/queries/guest-order.md +++ b/src/pages/graphql/schema/orders/queries/guest-order.md @@ -4,15 +4,15 @@ title: guestOrder query # guestOrder query -Use the `guestOrder` query to retrieve details about an order placed by a guest or customer who is not logged in. To retrieve this information, the guest must supply the order number, email, and postal code used to create the order. +Use the `guestOrder` query to retrieve details about an order placed by a guest or customer who is not logged in. To retrieve this information, the guest must supply the order number, email, and last name that was used to create the order. ## Syntax -`{guestOrder(input: OrderInformationInput!) {CustomerOrder!}}` +`{guestOrder(input: GuestOrderInformationInput!) {CustomerOrder!}}` ## Reference -The `guestOrder` reference provides detailed information about the types and fields defined in this query. +The [`guestOrder`](https://developer.adobe.com/commerce/webapi/graphql-api/index.html#query-guestOrder) reference provides detailed information about the types and fields defined in this query. ## Example usage @@ -24,7 +24,7 @@ The `guestOrder` reference provides detailed information about the types and fie input: { number: "000000001", email: "test@example.com", - postcode: "12345-6789" + lastname: "User" } ) { status