Back to connectors… Back to Other...

Shopify Product MetaFields (7 replies)

RogerD
5 years ago
RogerD 5 years ago

I am trying to read/write metafields within Shopify. According to the Shopify connector this should be possible but it doesn’t really go into much detail or provide an example.
I have looked at the API call on the Shopify side and it is using a JSON URL with Get and Post operations so my thought was to use the JSON Writer to create a metafield and then see if could read it back.
To do this I used a DB Reader to read some item information from Sage 300 and then transformed that to add the fields related to the metafield.
So far so good (assuming of course that this is the right approach at all) but when I hit Refresh on the JSON Writer I get this
My webservice behavior tests out OK so I don’t understand why I’m getting this error.

Support
5 years ago
Support 5 years ago

Roger, I think you're referring to the following page in our documentation.

https://www.realisable.co.uk/support/Documentation/shopify/Touchpoints/ProductMetaUpload.htm

You don't need to create a separate JSON writer as the Shopify connector already supports the ability to insert/update product and customer metafields.

Attached are two screenshots showing the Product MetaField upload. The fields should be populated as follows:

  1. product_id – The shopify product id (mandatory).
  2. description – A description of the information that the metafield contains. (optional)
  3. key – This is the key of the metafield (mandatory). I.e. You may have a key of 'ean' or 'isbn'.
  4. id – This is the id of the meta field. This is readonly, and is returned when you insert/update the metafield. As stated in the documentation when this is populated the metafield have been successfully updated/inserted.
  5. namespace – Leave blank.
  6. value – This is the value assigned to the metafield. (mandatory) In the example above it would be the ean or isbn code.
  7. value_type – Should be either 'string' or 'integer'; representing the type of the field (required).

Hope this helps.

https://www.realisable.co.uk/wp-content/uploads/2020/01/ProductMetaImportTypeSelection-1.png
https://www.realisable.co.uk/wp-content/uploads/2020/01/FieldList-1.png
RogerD
5 years ago
RogerD 5 years ago

To create a transaction in Shopify, set the desired fields, but do not specify a value against the ‘id’ field. If a field is mapped to an id field and the field is empty, the field will be populated with the id assigned by Shopify to the field.

To update a record in Shopify specify the record’s valid ‘id’ field. Some import types, such as updating an existing product's default variant require that both the id and variant_id are specified.

Following this instruction I have created a field in my transform called product_id which is intended to hold the id returned by the Shopify Create action. I then have another Shopify Connector connected to this transform (Priority 2) to create the meta-field for this item. Attached is a pic.

In the create (upper) connector I have the product_id field assigned to the id field which based on the above should assign it
The item is getting created just fine, but the metafield creation is failing (see attached image).

You can see the Product ID field in the above, and it seems to be getting a value (I’m not sure why ID has one value after it and Product ID has a different value but I believe the 448… number is correct)

The problem seems to be that when the second connector fires it is not getting this value. I believe this can be seen from the url, the // should have the ID number in it based on my reading.

I have tried Product ID as both text and integer and get the same problem. As you can see the rest of the metafield definition seems OK
What am I doing wrong?

Also, the Shopify API seems to indicate that it is possible to create a product with metafields at the same time but it appears the Iman connector requires this to be two steps?

https://www.realisable.co.uk/wp-content/uploads/2020/01/ProductMapping.jpg
https://www.realisable.co.uk/wp-content/uploads/2020/01/ProductMeta.jpg
https://www.realisable.co.uk/wp-content/uploads/2020/01/JSON.jpg
https://www.realisable.co.uk/wp-content/uploads/2020/01/Design.jpg
Support
5 years ago
Support 5 years ago

Roger, looking at the design of your integration the Meta Fields is a branch so it will never contain the product id.

You would need to add the Product Meta create/update to after the Product create/update.

In respect to the Meta Fields being included with the product - you are correct. I suspect this has been added recently. We're happy to add this as part of the connector. The only pitfall will be the meta fields will be a child to the parent, so you would need to have records for each meta field (but you are doing this in any case).

If you please leave this with us and we will get an updated connector either later today, or more likely Monday (it's a relatively small addition).

RogerD
5 years ago
RogerD 5 years ago

I considered that but could not determine an efficient way to do this. I have tried connecting a transform after the create step on the assumption that the fields would pass through but this was only partially successful. 

The following fields were passed through

Trans ID Product

  • body_html
  • product_type
  • vendor
  • title

Variants

  • weight
  • variant_id
  • inventory_policy
  • inventory_management
  • price

Options

nothing

What is strange here is that Variant_ID is passed along (a created field) but Product_ID (another created field) is not. Furthermore fields like 'weight' were never defined in the previous transformations but appear here. 

Since I need Product ID to define the metafield I'm not sure how to do it 'after' the create step

 

 

 

 

 

RogerD
5 years ago
RogerD 5 years ago

Did you publish a new connector with the ability to add Product with Metafields at the same time? So far nothing I have done seem to let the variables that are defined flow throught the create process. Without this, or the ability to create the metafield with the product, the process gets complex. I also need to write the Product_ID back to an optional field on the item in Sage 300. If this ID is written back, how can it be accessed after the Create function?

Support
5 years ago
Support 5 years ago

Roger, if a field is mapped to the id field and the variant_id fields they will be populated by Shopify Id.

Below are two screenshots indicating such behaviour.

Thanks

 

https://www.realisable.co.uk/wp-content/uploads/2020/01/Preview.png
https://www.realisable.co.uk/wp-content/uploads/2020/01/FieldMapping.png
Support
5 years ago
Support 5 years ago

We have reviewed adding the MetaFields into the Product upload and whilst it is possible the Shopify API is slightly deficient in it's reply.

In short, whilst MetaFields are an extremely useful feature of Shopify data, they are treated by the API like second class citizens.

Whereas the Product & Variant uploads reply with the relevant ids (for the product and variants), the Shopify API does not reply with any meta field ids (or any of the meta field information), thus making things clumsy and non-uniform.

This may have been the reason in the first place for having separate touchpoints for the product and customer metafields (though the reason has been lost in the mist of time).

The Shopify connector removes some of the heavy lifting when dealing with metafields. It first queries Shopify using the (string) key to first obtain the id of the matching record, then performs the insert or update based on whether the query returned a record or not.

Hope this helps.

Contact

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close

Request Demo

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close

Access Downloads

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close