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
count(params \\ %{})
Retrieve a count of all customers.
create(params)
Specs
create(map()) :: Shopify.Operation.t()
Create a customer.
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.
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{}}
delete(customer_id)
Specs
delete(binary()) :: Shopify.Operation.t()
Delete a customer.
Note that a customer cannot be deleted if they have existing orders.
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)
get(customer_id)
Specs
get(binary()) :: Shopify.Operation.t()
Retrieve a single customer.
get_metafield(customer_id, metafield_id)
Specs
get_metafield(binary(), binary()) :: Shopify.Operation.t()
Retrieve a single customer metafield
get_metafields(customer_id)
Specs
get_metafields(binary()) :: Shopify.Operation.t()
Retrieve all metafields belonging to a customer.
get_orders(customer_id)
Specs
get_orders(binary()) :: Shopify.Operation.t()
Retrieve all orders belonging to a customer.
list(params \\ %{})
Specs
list(map()) :: Shopify.Operation.t()
Retrieve a list of customers.
search(params)
Specs
search(map()) :: Shopify.Operation.t()
Search for customers that match a given query.
send_invite(customer_id, params)
Specs
send_invite(binary(), map()) :: Shopify.Operation.t()
Send an account invite to a customer.
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)
}
update_metafield(customer_id, metafield_id)
Specs
update_metafield(binary(), binary()) :: Shopify.Operation.t()
Updates a single customer metafield