Metafields



With ONIXEDIT Bookstore, it is possible to bind any ONIX field to a Shopify metafield. ONIXEDIT Bookstore supports standard structured metafields defined using one of the following types:



ONIXEDIT Bookstore does not support unstructured metafields.


Shopify metafields are very useful for storing ONIX field values. Once stored in metafields, the data can easily be displayed on your Shopify website wherever product information is shown. For more details, refer to the following Shopify page:


https://help.shopify.com/en/manual/custom-data/metafields/displaying-metafields-on-your-online-store


You can define metafields at the product or variant level. The latter is especially useful if you enable the ONIXEDIT Bookstore option to group imported ONIX products based on their titles and contributor names. See the Variants section of this user manual for more details.


Metafields defined at the product level will be updated each time you import an ONIX product with the same ID (ISBN, EAN, or RecordReference), or with the same title and contributor names if variant grouping is enabled in your ONIXEDIT Bookstore settings. If the variant option is activated, this means your product-level metafields will be overwritten each time with the latest matching ONIX metadata.


However, if you define metafields at the variant level, each variant will retain its own distinct metadata values, preventing the product-level metafields from being overwritten.


Binding an ONIX field to a Shopify Metafield


To bind an ONIX field to a Shopify Metafield, follow these steps:



1- Click the button labeled "Add a new binding". ONIXEDIT Bookstore will insert a blank entry at the end of the binding list.

2- Click the Edit button next to the blank entry. The following window will appear:



3- Select the metafield you want to bind:


4- Select the ONIX field from which the value should be taken, using a predefined list of common ONIX tags:


5- Click on the "Submit" button.


When you're finished, don't forget to save your ONIXEDIT Bookstore settings:





Using XPATH for advanced binding


If you don’t find the ONIX field you’re looking for in the ONIX Token dropdown list (see step #4), or if you have more advanced needs such as conditional data retrieval or repurposing ONIX values, XPATH is the solution for you. 




ONIXEDIT Bookstore supports XPATH versions 2.0 up to 3.1. For example, the following XPATH expression will return the ContributorStatement field if it is defined; otherwise, it will return a concatenation of all contributor names separated by ", ":


if(//Product/DescriptiveDetail/ContributorStatement) then //Product/DescriptiveDetail/ContributorStatement else

string-join(for $c in //Product/DescriptiveDetail/Contributor return $c/PersonName, ", ")


And the following expression:


concat(//Product/DescriptiveDetail/Measure[MeasureType ='01' and MeasureUnitCode = 'mm']/Measurement, ' x ', //Product/DescriptiveDetail/Measure[MeasureType ='02' and MeasureUnitCode = 'mm']/Measurement)


Will assign the following value to the corresponding metafield:





Visit the ONIXEDIT website for practical examples of what you can do with XPATH combined with ONIX.



Binding ONIX fields to a list of values


Some metafield types can be configured as "list of values":



Using ONIXEDIT Bookstore metafield XPATH functionality, you can bind multiple values to such a field. For example, if you want to bind contributor names to a metafield configured to accept multiple values, ONIXEDIT Bookstore can parse a string containing values separated by commas, like this: "value1,value2,value3".


To achieve this, you can use the following XPATH expression to retrieve all contributor names associated with an ONIX product:


string-join(for $c in //Product/DescriptiveDetail/Contributor return $c/PersonName, ",")


Each contributor name will then be stored as an individual item in the metafield, as shown in the following screen capture:



Examples of valid values for each supported type


  • Single line text: "Abc123"
  • Multi-line text: "This is a
                              valid text"
  • Integer: 999
  • Decimal: 999.99
  • Boolean: "True" or "False"
  • Date: Compliant to the ONIX standard (YYYYMMDD)
  • Weight: "10 kg"
  • Dimension: "20 cm"
  • URL: "https://onixedit.com/en-us/"
  • ID: "12345"

Created with the Personal Edition of HelpNDoc: Maximize Your CHM Help File Capabilities with HelpNDoc