Last Updated on by LAUNCHTIP
(Originally Published August 16, 2023.)
You might want to create a custom table for storing a certain piece of information in Shopify. For instance, if you want to display information for store locations, you may want to load it from a source instead of hard-coding it.
Here are some ways to store data on Shopify.
Storing Data In Shopify
If you want to store data in Shopify, you can use custom fields known as “Metafields”. Since it’s accessible with the liquid template, you can store any information here.
You can add metafields to the following type of resources:
- Blogs and articles
- Draft orders
- Pages and Orders
- Custom Collections
- Product Variants
Properties Of A Metafield
Each meta field has certain properties. Here they are:
- Created at: It’s the time when you created the metafield.
- Updated at: Since you can update the metafields, this is the time you updated it last.
- Description: It’s the information that’s in the metafield.
- ID: Meta fields also have unique IDs.
- Key: Key refers to the metafield’s name. The maximum length is 30 characters, while the minimum is three characters.
- Owner Resource: Every metafield is associated with one of the resources listed above.
You can learn more about metafields and endpoints in this Shopify guide.
Create a new model or object
If you want to create a new record type to hold Authors of a book for example, you can use “Metaobjects”. These allow you to set the fields within the object so you could create Author Name, Author Description and Author Image.
You could then go into your Shopify products, identify the books this author has written and attach the relevant Author record to this product.
Finally, you can display this information on the storefront through theme sections and dynamic data. There is a great video below which walks you through how to do this:
Other Ways To Add Data
Apart from meta fields, there are some other ways to store data on Shopify too. First off, you can keep all your data on pages. It’s straightforward to edit the HTML.
Secondly, you can write blog posts if you have to store a lot of information. On the other hand, if the information is minimum, you can use tags.
Meanwhile, link lists are suitable for smaller data sizes that must be in order.