Difference between revisions of "API Variation"

From Spiffy Stores Knowledge Base

Line 63: Line 63:
 
The wholesale price of the product variation. This price is used whenever a customer with the wholesale attribute logs in to the store.
 
The wholesale price of the product variation. This price is used whenever a customer with the wholesale attribute logs in to the store.
 
|-
 
|-
 +
|compare_at_price
 +
|<code>{ "compare_at_price" : 69.95 }</code><br/>
 +
This price is used to show the regular price of a variation to highlight how much is being saved.
 +
|-
 +
|discount
 +
|<code>{ "discount" : 5.00 }</code><br/>
 +
This is the amount that this variation can have as a discount when it is eligible for a shopping cart discount. This amount overrides any general discount calculation for the cart.
 +
|-
 +
|taxable
 +
|<code>{ "taxable" : true }</code><br/>
 +
Indicates whether the product variation is subject to tax. Some items, such as food or books may be exempt from taxes such as GST or VAT.
 +
|-
 +
|instalments
 +
|<code>{ "instalments" : 1 }</code><br/>
 +
If instalments are enabled for this product, then this indicates the number of instalments that must be paid for this variation.
 +
|-
 +
|grams
 +
|<code>{ "grams" : 200 }</code><br/>
 +
The weight of the product variation in grams.
 +
|-
 +
|length
 +
|<code>{ "length" : 100 }</code><br/>
 +
The length of the product variation in cms.
 +
|-
 +
|width
 +
|<code>{ "width" : 50 }</code><br/>
 +
The width of the product variation in cms.
 +
|-
 +
|height
 +
|<code>{ "height" : 20 }</code><br/>
 +
The height of the product variation in cms.
 +
|-
 +
|inventory_quantity
 +
|<code>{ "inventory_quantity" : 10 }</code><br/>
 +
The number of items in stock for this product variation.
 +
|-
 +
|old_inventory_quantity
 +
|<code>{ "old_inventory_quantity" : 10 }</code><br/>
 +
The original number of items in stock for this product variation. This value must be provided when attempting to update the inventory quantity. If the old_inventory_quantity no longer matches the actual inventory quantity because the value has been updated elsewhere, then the attempt to update the quantity will fail and should be retried.
 +
|-
 +
|inventory_quantity_adjustment
 +
|<code>{ "inventory_quantity_adjustment" : 5 }</code><br/>
 +
If it is not important to determine the exact level of the inventory quantity, then an adjustment can be used instead to increment or decrement the inventory quantity by a certain amount.
 +
|-
 +
|inventory_policy
 +
|<code>{ "inventory_policy" : "continue" }</code><br/>
 +
Specifies whether or not customers are allowed to place an order for a product variation when it's out of stock. Valid values are:
 +
* deny (default): Customers are not allowed to place orders for a product variation when it's out of stock.
 +
* continue: Customers are allowed to place orders for a product variation when it's out of stock.
 +
 
|}
 
|}
  
  
 
 
 
 
  :compare_at_price => variation.compare_at_price,
 
  :discount => variation.discount,
 
  :taxable => !variation.tax_free,
 
  :instalments => variation.instalments,
 
  :grams => variation.weight_in_grams,
 
  :length => variation.length_in_cms,
 
  :width => variation.width_in_cms,
 
  :height => variation.height_in_cms,
 
  :inventory_quantity => variation.inventory_quantity,
 
  :old_inventory_quantity => variation.inventory_quantity,
 
  :inventory_policy => variation.inventory_policy,
 
 
   :inventory_management => variation.inventory_management,
 
   :inventory_management => variation.inventory_management,
 
   :fulfilment_service => variation.fulfilment_service,
 
   :fulfilment_service => variation.fulfilment_service,

Revision as of 15:09, 20 November 2014

The Spiffy Stores API Variation object represents a product variation. A variation usually represents some physical version of a product that needs to be represented separately from other variations. Each product variation can have its inventory tracked separately.

You can view a product's variations, update them, create new ones, and delete them.

Accessing a Product

If you want to refer to a single Product then you will need to use the unique id that has been assigned to that object.

The object ids are internally generated by the software and cannot be created or assigned.

Alternatively, you may specify the object handle in place of the object id when requesting access to the object. The handle is the unique character string that is assigned to every product when it is created. The handle is used in the URL to display the product page.

For example, you may retrieve a product's variations in two ways.

GET /api/products/12345678/variations.json

or

GET /api/products/cute-dog/variations.json

The advantage of using the handle form of the request is that you don't need to search all the products first in order to determine the product id, as you will already know what the handle is. This will reduce the number of API calls that you need to make and greatly simplifies the amount of coding that is needed to manage your products.

Variation Properties

id { "id" : 12345 }

A unique numeric identifier for the variation.

product_id { "product_id" : 123456789 }

The unique numeric identifier for the product.

title { "title" : "Red/Wool" }

The title of the product variation.

position { "position" : 1 }

The position of the variation in the list of all product variantions. Position number 1 is at the top of the list.

sku { "sku" : "P123456REDW" }

A unique identifier for the product variation, normally used for stock tracking purposes.

barcode { "barcode" : "1234567809" }

The barcode, which is usually the UPC or ISBN number for the product variation.

price { "price" : 49.95 }

The price of the product variation.

wholesale_price { "wholesale_price" : 29.95 }

The wholesale price of the product variation. This price is used whenever a customer with the wholesale attribute logs in to the store.

compare_at_price { "compare_at_price" : 69.95 }

This price is used to show the regular price of a variation to highlight how much is being saved.

discount { "discount" : 5.00 }

This is the amount that this variation can have as a discount when it is eligible for a shopping cart discount. This amount overrides any general discount calculation for the cart.

taxable { "taxable" : true }

Indicates whether the product variation is subject to tax. Some items, such as food or books may be exempt from taxes such as GST or VAT.

instalments { "instalments" : 1 }

If instalments are enabled for this product, then this indicates the number of instalments that must be paid for this variation.

grams { "grams" : 200 }

The weight of the product variation in grams.

length { "length" : 100 }

The length of the product variation in cms.

width { "width" : 50 }

The width of the product variation in cms.

height { "height" : 20 }

The height of the product variation in cms.

inventory_quantity { "inventory_quantity" : 10 }

The number of items in stock for this product variation.

old_inventory_quantity { "old_inventory_quantity" : 10 }

The original number of items in stock for this product variation. This value must be provided when attempting to update the inventory quantity. If the old_inventory_quantity no longer matches the actual inventory quantity because the value has been updated elsewhere, then the attempt to update the quantity will fail and should be retried.

inventory_quantity_adjustment { "inventory_quantity_adjustment" : 5 }

If it is not important to determine the exact level of the inventory quantity, then an adjustment can be used instead to increment or decrement the inventory quantity by a certain amount.

inventory_policy { "inventory_policy" : "continue" }

Specifies whether or not customers are allowed to place an order for a product variation when it's out of stock. Valid values are:

  • deny (default): Customers are not allowed to place orders for a product variation when it's out of stock.
  • continue: Customers are allowed to place orders for a product variation when it's out of stock.


 :inventory_management => variation.inventory_management,
 :fulfilment_service => variation.fulfilment_service,
 :shipping_code => variation.shipping_code,
 :free_shipping => variation.free_shipping,
 :requires_shipping => !variation.no_shipping_required,
 :ship_separately => variation.ship_separately,
 :created_at => variation.created_at,
 :updated_at => variation.updated_at