Metafields
Retrieves a list of metafields that belong to a resource.
View-Specific Information
OwnerResource or the metafield Id is required for any query against Metafields.
OwnerResource must be one of the following values:
- shop
- draft_order
- product
- variant
- page
- article
- order
- customer
- collection
- blog
- product_image
Any other value will run the query against "shop" instead.
Select
The cmdlet uses the Shopify API to process search criteria for all columns except Value and Description. The supported SQL operators are '=,IN' for the Id, OwnerResource and OwnerId columns, '=' for the Namespace, Key, Type columns and '=,<=,<,>,>=' for the CreatedAt and UpdatedAt columns. The cmdlet processes other filters client-side within the cmdlet.For example, the following queries are processed server-side:
SELECT * FROM Metafields WHERE Id = 721389482
SELECT * FROM Metafields WHERE ID IN (SELECT Id FROM Customers)
SELECT * FROM Metafields WHERE ID IN (19422939054103, 19422939185175, 19422939250711, 19431415152663, 19431415185431)
SELECT * FROM Metafields WHERE OwnerId = 64146833431 AND OwnerResource = 'product'
SELECT * FROM Metafields WHERE OwnerId = 64146833431 AND OwnerResource IN ('product', 'customer')
SELECT * FROM Metafields WHERE OwnerId IN (64146833430, 64146833431) AND OwnerResource = 'product'
SELECT * FROM Metafields WHERE OwnerResource = 'customer' AND OwnerId IN (SELECT Id FROM Customers);
SELECT * FROM Metafields WHERE OwnerResource = 'product' AND OwnerId = '64146735127' AND UpdatedAt >= '2021-10-13T05:55:08-04:00';
SELECT * FROM Metafields WHERE OwnerResource = 'product' AND OwnerId = '64146735127' AND Type = 'multi_line_text_field';
Insert
You must specify the NameSpace, Key, and Value to create Metafields.
INSERT INTO Metafields (NameSpace, Key, Value, Type, Description, OwnerResource) VALUES ('inventory', 'warehouse', 25, 'number_integer', 'This is description about data', 'factory')
Update
You must specify the Id to update Metafields. For example:
UPDATE Metafields SET Value = 26 WHERE Id = 19712314851607
Delete
You must specify the Id of the Metafields to delete it.
DELETE FROM Metafields WHERE Id = 19712314851607
Columns
Name | Type | ReadOnly | References | Description |
Id [KEY] | Long | True |
The unique ID of the metafield. | |
Namespace | String | False |
A container for a set of metafields. You need to define a custom namespace for your metafields to distinguish them from the metafields used by other apps. | |
Key | String | False |
The name of the metafield. | |
Value | String | False |
The information to be stored as metadata. | |
Type | String | False |
The metafield's information type. | |
Description | String | False |
A description of the information that the metafield contains. | |
OwnerId | Long | False |
The unique ID of the resource that the metafield is attached to. | |
OwnerResource | String | False |
The type of resource that the metafield is attached to. | |
CreatedAt | Datetime | True |
The date and time (ISO 8601 format) when the metafield was created. | |
UpdatedAt | Datetime | True |
The date and time (ISO 8601 format) when the metafield was last updated. | |
AdminGraphqlApiId | String | True |
The admin graphql api id |