ExShopify v0.2.0 ExShopify.ProductVariant

Different version of a product.

Summary

Functions

Receive a count of all product variants

Create a new product variant

Delete a product variant

Receive a single product variant

Receive a list of all product variants

Modify an existing product variant

Types

product_variant_plural()
product_variant_plural() :: {:ok, [%ExShopify.ProductVariant{barcode: term, compare_at_price: term, created_at: term, fulfillment_service: term, grams: term, id: term, image_id: term, inventory_management: term, inventory_policy: term, inventory_quantity: term, inventory_quantity_adjustment: term, metafields: term, old_inventory_quantity: term, option1: term, option2: term, option3: term, position: term, price: term, product_id: term, requires_shipping: term, sku: term, taxable: term, title: term, updated_at: term, weight: term, weight_unit: term}], %ExShopify.Meta{api_call_limit: term}}
product_variant_singular()
product_variant_singular() :: {:ok, %ExShopify.ProductVariant{barcode: term, compare_at_price: term, created_at: term, fulfillment_service: term, grams: term, id: term, image_id: term, inventory_management: term, inventory_policy: term, inventory_quantity: term, inventory_quantity_adjustment: term, metafields: term, old_inventory_quantity: term, option1: term, option2: term, option3: term, position: term, price: term, product_id: term, requires_shipping: term, sku: term, taxable: term, title: term, updated_at: term, weight: term, weight_unit: term}, %ExShopify.Meta{api_call_limit: term}}

Functions

count(session, product_id)
count(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t) ::
  ExShopify.Resource.count |
  ExShopify.Resource.error

Receive a count of all product variants.

Examples

iex> ExShopify.ProductVariant.count(session, 632910392)
{:ok, count, meta}
create(session, product_id, params)
create(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, map) ::
  product_variant_singular |
  ExShopify.Resource.error

Create a new product variant.

Examples

Create a product variant

iex> params = %{
...>   option1: "Yellow",
...>   price: "1.00"
...> }

iex> ExShopify.ProductVariant.create(session, params)
{:ok, product_variant, meta}

Create a new product variant with a metafield

iex> params = %{
...>   option1: "Blue",
...>   metafields: [
...>     %{
...>       key: "new",
...>       value: "newvalue",
...>       value_type: "string",
...>       namespace: "global"
...>     }
...>   ]
...> }

iex> ExShopify.ProductVariant.create(session, params)
{:ok, product_variant, meta}

Create a new product variant with an image

iex> params = %{
...>   option1: "Blue",
...>   image_id: 850703190
...> }

iex> ExShopify.ProductVariant.create(session, params)
{:ok, product_variant, meta}
delete(session, id, product_id)
delete(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, integer | String.t) ::
  ExShopify.Resource.meta_only |
  ExShopify.Resource.error

Delete a product variant.

Examples

iex> ExShopify.ProductVariant.delete(session, 808950810, 632910392)
{:ok, meta}
find(session, id)
find(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t) ::
  product_variant_singular |
  ExShopify.Resource.error
find(session, id, params)
find(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, map) ::
  product_variant_singular |
  ExShopify.Resource.error

Receive a single product variant.

Examples

iex> ExShopify.ProductVariant.find(session, 808950810)
{:ok, product_variant, meta}
list(session, product_id)
list(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t) ::
  product_variant_plural |
  ExShopify.Resource.error
list(session, product_id, params)
list(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, map) ::
  product_variant_plural |
  ExShopify.Resource.error

Receive a list of all product variants.

Examples

iex> ExShopify.ProductVariant.list(session, 632910392)
{:ok, product_variants, meta}
update(session, id, params)
update(%ExShopify.Session{access_token: term, api_key: term, domain: term, port: term, protocol: term, secret: term, shop_name: term, shop_url: term}, integer | String.t, map) ::
  product_variant_singular |
  ExShopify.Resource.error

Modify an existing product variant.

Examples

Update a variant’s inventory

iex> params = %{
...>   inventory_quantity: 100,
...>   old_inventory_quantity: 10
...> }

iex> ExShopify.ProductVariant.update(session, 808950810, params)
{:ok, product_variant, meta}

Add a metafield to an existing variant

iex> params = %{
...>   metafields: [
...>     key: "new",
...>     value: "newvalue",
...>     value_type: "string",
...>     namespace: "global"
...>   ]
...> }

iex> ExShopify.ProductVariant.update(session, 808950810, params)
{:ok, product_variant, meta}