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!

About the author

Remi Hey! My name is Rémi Corson, I'm a French WordPress Developer, I code stuff and I write from time to time ;-) Buy a coffee
Show your support

Related Posts

11 comments

  1. watchteller:

    Thanks Remi. You are the best.

    Especially all your snippets.

    Thanks again.

  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 );

  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.

  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