Metafields
In this article
To delete Metafields in Shopify
eCommerce - Shopify provides a feature to sync metadata (metafields) from LS Central to Shopify for products and customers.
Metafields Usage
Metafields in LS Central allow additional product data to be passed to Shopify. To utilize this functionality, it is critical to understand the role of metadata settings and how attributes and custom fields interact with metafield configurations.
The metafield feature can be activated by enabling the Use Metadata option. If attributes need to be included automatically, the Include Attributes in Metadata option can also be enabled. However, these are distinct settings:
- Using Metadata is mandatory if any metafield functionality is required.
- Including Attributes in Metadata is optional and should only be enabled if item attributes should automatically be pushed as metafields.
Additionally, there is an option to include attributes in the HTML. If desired, both the metafield and HTML inclusion settings can be enabled for full visibility on the storefront and in structured data.
Initial Configuration
To begin using metafields, the following options in LS Central must be correctly configured:
- Enable Use Metadata — This is required to allow sending any metadata to Shopify.
- Disable Include Attributes in Metadata — Optional. If enabled, it automatically includes all item attributes as metadata.
Note: You only need to enable Include Attributes in Metadata if you want all item attributes to be sent automatically as part of the metafield. Otherwise, you can manually map and send only specific fields.
To Send Metafields to Shopify
Method 1: Configure mapping in LS Central, then send to Shopify.
- Click the
icon, enter Shopify Administrationand select the relevant link.
- In the Settings FastTab, enable Use Metadata.
- Then, navigate toRelated - Mapping - Metadata which opens the Shopify Mapping Metadata page in LS Central, where you can map data fields to Shopify metafields.
- Put BC table Id and Field Id of the value that should appear in Shopify as metafield. This defines how data from LS Central is transferred and displayed in your Shopify store. Refer the screenshot below for a sample configuration of metafield mappings in LS Central. Put as DefField, Table Id in Index Field and Field Id in Index Value and metafield name in Meta Code. Any field from Item table (27) can be used and also any field from a table that has Item No. relation to Item table. Attributes can also be renamed instead of using the Attribute name. Put DefAttribute with Attribute name in Index Field and the metadata name that should be used in Shopify in Meta Code.
- Go back to the Shopify Administration page. Click Actions - Item - Send Item to send the mapped metafields for the specific item (for example, 40410 – Asian Hat) to Shopify.
Note: You do not need to enable the Send Prices or Images options. Simply enter the item number and click OK to proceed.
- Open the Shopify Admin web site, and navigate to Settings - Metafields and metaobjects - Products. Click View unstructured metafields, then add a definition for each metafield key that was successfully synced from LS Central and click Save.
- After adding and saving the definitions for each synced metafield key, return to the Product Metafield Definitions page. This page should now display the list of defined metafields, matching the configuration set in the mapping table in LS Central.
- Go to the Products section in Shopify and search for item Asian Hat. Open the product and scroll down to the Metafields section and verify that all synced metafield keys and their corresponding values are displayed correctly.
- You can also update the metafields for all items available in Shopify by going back to Shopify Administration page and navigating to Update - Items.
Note: No additional mapping is required if you want to apply the same metafield configuration that was previously set up. This method is particularly useful for updating metafields across bulk products efficiently.
- Open the Shopify Admin web site, and navigate to Settings - Metafields and metaobjects - Products. You are redirected to the Product metafield definitions page where you see the list of defined metafields along with the number of products each metafield is applied to.
- Open the Shopify Admin web site, and navigate to Settings - Metafields and metaobjects - Products. You are redirected to the Product metafield definitions page where you see the list of defined metafields along with the number of products each metafield is applied to.
- Go to the Products and pick one from the list (for example, 40170 – Bag Linda). Scroll down to the Metafields section and verify that all synced metafield keys and their corresponding values are displayed correctly.
Method 2: Create Metafield Definition in Shopify and Map in LS Central
- Open the Shopify Admin web site, and navigate to Settings - Metafields and metaobjects - Products. Click Add Definition.
- You are redirected to the Add Product metafield definitions page where you can enter the name, customize the namespace and key, select the type, and then click Save to create the metafield definition.
Note: Be sure to change the namespace from custom to lsretail, as this is hardcoded.
- Open Shopify Administration page and navigate to Related - Mapping - Metadata. This opens the Shopify Mapping Metadata page in LS Central, where you can map the product metafields that were previously created in Shopify, as shown in the last row of the screenshot below.
Note: The index value can be retrieved from the Item table in the code. You can access this information through our GitHub repository.
- Go back, click Actions - Item - Send Item to send the mapped metafields for the selected item (e.g. 40410 – Asian Hat) to Shopify.
- Open the Shopify Admin web site, and navigate to Settings - Metafields and metaobjects - Products. You are redirected to the Product metafield definitions page where you see the newly added metafield definition Occasion, along with the count of product it is currently used in.
- Go to the Products and choose (for example, 40410 – Asian Hat). Scroll down to the Metafields section and verify that all synced metafield keys and their corresponding values are displayed correctly.
- Go to the Products and pick one from the list (e.g. 40170 – Bag Linda). Scroll down to the Metafields section and verify that Occasion metafield is synced and that its corresponding value is displayed correctly.
To delete Metafields in Shopify
Metafields cannot be deleted from LS Central. To delete a Metafield, open Shopify Administration web site
- Go to Settings - Metafields and metaobjects - Products, then click on the definition you want to delete (for example, Vendor No).
- In the definition details page, click More actions - Delete definition, then choose whether to delete the field only or delete the field and its saved values, and click Delete to confirm.
Note: Selecting delete the field and its saved values permanently removes the metafield and all associated data from your products in Shopify. This action cannot be undone.