Chord OMS
...
Gatsby
SDK Reference

useUser

8min

The useUser hook returns a series of methods for managing a Shopify customer account. The customer must have an active authentication session (see useAuth) for these methods to work.

user

Represents the current user.

Example:

status

String indicating the status of the user in Redux. This string can be used to determine if the user has been loaded yet, which happens asynchronously after page load.

Example:

createUserAddress()

Adds a new address to the Shopify customer's address book.

Example:

loadUser()

Reloads the current user. This is automatically called on every page load and with every other useUser method.

Example:

modifyUserAddress()

Updates an address in the Shopify customer's address book.

Example:

modifyUserDefaultAddress()

Updates which address is marked as the default address in the Shopify customer's address book.

Example:

removeUserAddress()

Removes an address from the Shopify customer's address book.

Example:



Updated 03 Mar 2023
Did this page help you?