Improve WooCommerce Google Feed Products Title with YOAST SEO

Some of you may use the popular YOAST SEO plugin with WooCommerce to improve your search results in Google. And some of you also use our Google Product Feed plugin.

But, the problem is that Google Product Feed doesn’t use YOAST SEO titles but WordPress products default titles. This has main issues. The first one is that your title aren’t optimized for SEO purposes, and the second one is that you can have encoding issues.

The good news is that with a simple snippet you can decide to use YOAST SEO product titles instead of default product titles. It’s pretty simple, all you have to do is to add this little snippet in the file called functions.php in your theme’s folder and BOOM!

11 responses to “Improve WooCommerce Google Feed Products Title with YOAST SEO”

  1. watchteller

    Thanks Remi. You are the best.

    Especially all your snippets.

    Thanks again.

    1. Thanks! Much appreciated!

  2. douglsmith

    Very useful, Remi!

    How might it work to override one of the other fields since they’re not stored as simply? For example, I already have an ISBN number as a product attribute that could be used instead of entering it again for the Global Trade Item Number (GTIN) and ISBN fields.

    Looks like there are filters but I haven’t been able to quite figure out how to put it together.


    // General, or feed-specific items
    $feed_item->additional_elements = apply_filters( 'woocommerce_gpf_elements', array(), $feed_item->ID );
    $feed_item->additional_elements = apply_filters( 'woocommerce_gpf_elements_'.$this->feed_format, $feed_item->additional_elements, $feed_item->ID );

    1. I guess you’ll need to use get_the_terms() in that case.

    2. leewillis77

      Hi;

      Have you checked out the docs page here:

      http://docs.woothemes.com/document/google-product-feed/

      There are example snippets on there that show how to use those filters, specifically you’ll want to add an element to the elements array whose key is the value you want to set, and the value is AN ARRAY of values. So – to set GTIN to “123”, you’d do:

      $elements['gtin'] = array('123');

      Hope that helps!

  3. douglsmith

    get_the_terms() is the easy part. I’m stuck figuring out how to construct the proper variable name within the array to assign it to.

  4. Goozleology

    I’ve tested just about every SEO plugin created and I continue to use Yoast’s plugin on all of my clients’ sites and mine as well. Plus, you can’t beat that it’s free.

    1. Did I say it was a bad plugin? ;-)

  5. philipboomy

    Hi Remi

    Thanks for providing this. I cannot get it to work. Nothing is outputted in the title in the feed. I have checked the filter and the meta value is still _yoast_wpseo_title so something else must have changed. Could you help me out with this?

  6. philipboomy

    Not sure why my comment is not showing so writing again. Normally it would say pending but I am not seeing that.

    I tried the above snippet and it is not working. The feed is showing empty titles. I checked filter and meta value of _yoast_wpseo_title. Both are the same still. So wondering what has changed. Is this still working for you?

    Thanks

  7. philipboomy

    Hi Remi

    I found out why it was not working. Its because the above snippet only works for Simple products. Any idea how to re-write this so it works for variations?

Leave a Reply