Difference between revisions of "Liquid Template Variables - metafields"

From Spiffy Stores Knowledge Base

(Created page with "The Liquid template variable '''metafields''' is associated with the following Liquid objects: * shop * product * variant * page * blog * collection * customer * order The '...")
 
m
Line 13: Line 13:
  
 
A '''metafield''' is made up of a key and a value organized with other keys and values under a common namespace. An optional description can also be store with the key and the value. Values can be stored as either '''strings''' or '''integers'''.
 
A '''metafield''' is made up of a key and a value organized with other keys and values under a common namespace. An optional description can also be store with the key and the value. Values can be stored as either '''strings''' or '''integers'''.
 +
 +
=== Metafield Examples ===
 +
 +
As an example, you might wish to record the physical location of your inventory. You might keep some products in Sydney and others in Melbourne.
 +
 +
<html>
 +
  <style type="text/css">
 +
  table.wikitable td { padding: 10px 20px !important; text-align: left; vertical-align: middle; }
 +
  </style>
 +
</html>
 +
{| class="wikitable" style="width: 100%"
 +
|style="width: 30%"|namespace
 +
|key
 +
|value
 +
|-
 +
|inventory
 +
|location
 +
|Sydney
 +
|-
 +
|inventory
 +
|location
 +
|Melbourne
 +
|}

Revision as of 14:27, 20 February 2015

The Liquid template variable metafields is associated with the following Liquid objects:

  • shop
  • product
  • variant
  • page
  • blog
  • collection
  • customer
  • order

The metafields object allows you to store extra information about your store, products, collections, orders, customers, blogs and pages. You can choose exactly what sort of information you wish to save and the exact format in which it's saved. This makes for a very powerful tool to assist you in the task of managing your store.

A metafield is made up of a key and a value organized with other keys and values under a common namespace. An optional description can also be store with the key and the value. Values can be stored as either strings or integers.

Metafield Examples

As an example, you might wish to record the physical location of your inventory. You might keep some products in Sydney and others in Melbourne.

namespace key value
inventory location Sydney
inventory location Melbourne