Discussions

Metatag Commerce

Metatag Commerce sandbox: https://drupal.org/sandbox/rvallejo/2102725

I've created a simple module to expand on the Metatag module to provide better support for commerce sites.

Currently the only thing DC-specific are some defaults I've set for some of the tags, but I'm also planning on adding a default Product Display configuration and would like to enable support for Product entities for the Metatag module. I welcome feedback and co-maintainers if anyone is interested.

I'm still in the process of developing it a little more. So far, tags included in the sandbox:

og:price:amount
og:price:currency
og:availability
og:brand
og:upc
og:ean
og:isbn

I also have the following tags in my working copy, which I'll commit later on today:

twitter:data1
twitter:label1
twitter:data2
twitter:label2

twitter:card "product", option added to available card types.

I expect some defaults will need tweaking to work with a more generic setup. I've been working on this to enable Pinterest rich pins, Twitter Cards, etc. for better integration with social networks.

I've also included a fix for og:image and twitter:image tags to split multiple images into multiple tags rather than a comma-delineated list (code originally written by fiftyz over at https://drupal.org/node/1305402#comment-6420040). I included the code as it's necessary to work with social networks, and because fiftyz's code only made the fix for open graph images -- eventually, the fix will probably be in the appropriate Metatag submodules.

Posted: Oct 2, 2013

Comments

rvallejo on October 7, 2013

No problem! The module may eventually be integrated with the main Metatag module as an optional submodule.

I still have to work out the implementation of product-entity meta tags - as of now, you can define them, but they don't generate the tags on a product display page. To enable product-related data for rich pins, twitter cards, etc., add them to your product display nodes or a product display node default from the Metatag administration page (you'll have to add the default configuration). I have both rich pins and twitter cards working with a site I developed and manage.

Let me know if you have any thoughts/comments/questions (either here, or ideally as an issue on the sandbox) - it's good to know others find it useful!

Benji on June 7, 2014

I'm trying to use this with Twitter product card but can't seem to get it working. How do I get the price and amount in the Product Display node metatag setup?

The following tokens are used in the Commerce Product metatag config:
Data1: [commerce-product:commerce-price:amount_decimal]
Label1: [commerce-product:commerce-price:currency_code]

When I tried copying those over to the Product display config, I got an error saying that the tokens were invalid.

Do you have a suggestion on how to fix this? Thank you.