Skip to main content

Product code metafield method

Please follow this guide if you want to store your Cylindo product code into a metafield, or if you got the following error message while going through the main guide:

Wrong product code error message

This error comes from the fact that your Cylindo products weren't configured to work in harmony with your Shopify products. The workaround is to create a Shopify product metafield that will store the Cylindo product code of your products.

Add the metafield definition​

Click on the Settings button on the Shopify admin dashboard left panel, then select Custom data and Products as depicted below. This should list all product-level metafields. Click on the Add definition button:

Fill in the fields with the following values:

Product code metafield definition

Click Save, then close the settings.

Configure the products​

Select the Products menu in the left side panel:

Products menu click

You should see a list of all products in your store. Select every product you plan to integrate the viewer with, and click the Bulk edit button. You'll be presented with an interface where you can edit every field of every products you selected. Make sure the cylindo_product_code column appears by selecting it in the Columns button, such as depicted here:

In another tab, go on your Cylindo products page. Make sure you can see the same products that you just selected in the previous step:

Cylindo product list

For every product, copy the Cylindo Product code (appearing in the second column) into its corresponding cylindo_product_code cell in the Shopify interface. The end result should look like this:

Product code bulk edit end result

Click on the Save button at the top right corner, and go back to the homepage of the Shopify admin dashboard.

Edit the theme code​

Your products are now well-configured, but we still need to make some changes to the theme custom code.

Click on the current theme's menu button, and select Edit code. Open the file product-media-gallery.liquid. You'll now replace the following line:

code="{{ product.handle }}"

with this one

code="{{ product.metafields.cylindo.cylindo_product_code }}"

If you customized the code or used one of our example, make sure to replace every occurrence of product.handle with product.metafields.cylindo.cylindo_product_code.

Click on the Save button, and preview the store. The product should now load correctly.