Search code examples
facebook-opengraphsquarespace

Squarespace & Open Graph, get product id?


i'm actually trying to get my squarespace eCommerce working with facebook, integration with micro data nearly work. when i test it on this url : https://business.facebook.com/ads/microdata/debug

they say that there is missing an id product meta : product:retailer_item_id

when i add it by code injection on product page :

<meta property="product:retailer_item_id" content="{ProductId}">

i get the value as it was a string not a variable.

i want to get product id or even the SKU to get it work with facebook integration

can't seem to find any solution for 2 days ...

maybe someone can help

many thanks


Solution

  • Unfortunately, adding that via a product collection's header code injection will result in exactly as you have found: it will output {ProductId} as a string. The use of JSON-T variables is only available when using developer mode with Squarespace version 7.0.

    So, you cannot use JSON-T variables via code injection. Therefore, there is no way to dynamically insert the product ID via the collection's code injection.

    Furthermore, at time of writing, you cannot use JavaScript to add og data, per the answers here and here.

    Therefore, the only way to achieve your desired outcome is using Developer Mode using Squarespace 7.0, and to create/edit the product.list and/or product.item files. But doing so is not recommended on a live website unless you have a good deal of experience working with developer mode and product collections. That is because Squarespace does not officially support custom product collections lists/items anymore. It is still possible to do, but only to a limited degree and one must avoid various bugs and pitfalls.