Shopify.Customer (exshopify v0.11.0)

https://help.shopify.com/en/api/reference/customers/customer

Link to this section Summary

Functions

Retrieve a count of all customers.

Create a customer.

Create an account activation URL for a customer account that is not yet enabled.

Create a metafield for a customer.

Delete a customer.

Delete a single customer metafield

Retrieve a single customer.

Retrieve a single customer metafield

Retrieve all metafields belonging to a customer.

Retrieve all orders belonging to a customer.

Retrieve a list of customers.

Search for customers that match a given query.

Send an account invite to a customer.

Update a customer.

Updates a single customer metafield

Link to this section Functions

Link to this function

count(params \\ %{})

Retrieve a count of all customers.

Specs

create(map()) :: Shopify.Operation.t()

Create a customer.

Link to this function

create_account_activation_url(customer_id)

Specs

create_account_activation_url(binary()) :: Shopify.Operation.t()

Create an account activation URL for a customer account that is not yet enabled.

Link to this function

create_metafield(customer_id, params)

Specs

create_metafield(binary(), map()) :: Shopify.Operation.t()

Create a metafield for a customer.

Examples

iex> data = %{ ...> metafield: %{ ...> namespace: "inventory", ...> key: "points", ...> value: 25, ...> value_type: "integer" ...> } ...> } iex> Shopify.Customer.create_metafield("12345", data) |> Shopify.request(session) {:ok, %Shopify.Response{}}

Link to this function

delete(customer_id)

Specs

delete(binary()) :: Shopify.Operation.t()

Delete a customer.

Note that a customer cannot be deleted if they have existing orders.

Link to this function

delete_metafield(customer_id, metafield_id)

Specs

delete_metafield(binary(), binary()) :: Shopify.Operation.t()

Delete a single customer metafield

Examples

iex> Shopify.Customer.delete_metafield("12345", "67890") |> Shopify.request(session)

Link to this function

get(customer_id)

Specs

Retrieve a single customer.

Link to this function

get_metafield(customer_id, metafield_id)

Specs

get_metafield(binary(), binary()) :: Shopify.Operation.t()

Retrieve a single customer metafield

Link to this function

get_metafields(customer_id)

Specs

get_metafields(binary()) :: Shopify.Operation.t()

Retrieve all metafields belonging to a customer.

Link to this function

get_orders(customer_id)

Specs

get_orders(binary()) :: Shopify.Operation.t()

Retrieve all orders belonging to a customer.

Link to this function

list(params \\ %{})

Specs

list(map()) :: Shopify.Operation.t()

Retrieve a list of customers.

Specs

search(map()) :: Shopify.Operation.t()

Search for customers that match a given query.

Link to this function

send_invite(customer_id, params)

Specs

send_invite(binary(), map()) :: Shopify.Operation.t()

Send an account invite to a customer.

Link to this function

update(customer_id, params)

Specs

update(binary(), map()) :: Shopify.Operation.t()

Update a customer.

Examples

iex> Shopify.Customer.update("12345", %{customer: %{first_name: "Tester"}) |> Shopify.request(session)
{:ok, %Shopify.Response{}}

# Add a metafield to an existing customer
iex> data = %{
...>   customer: %{
...>     id: 1092505370733,
...>     metafields: [
...>       %{
...>         key: "my_key",
...>         value: "abc",
...>         value_type: "string",
...>         namespace: "my_group"
...>       }
...>     ]
...>   }
...> }
...> Shopify.Customer.update("12345", %{customer: %{first_name: "Tester"}) |> Shopify.request(session)

}

Link to this function

update_metafield(customer_id, metafield_id)

Specs

update_metafield(binary(), binary()) :: Shopify.Operation.t()

Updates a single customer metafield