Woocommerce Google Product Feed – exclude / hide all products by default

If you love using WooCommerce as an ecommerce tool like me, at some point you will probably look into using the Google Product Feed extension.

This extension creates a feed for Google Merchant Center to pull from so your products show up in the Google Products section of search results. It’s a great extension and you can check it out at: http://www.woothemes.com/products/google-product-feed/

That said, I ran into an issue with this extension. By default the extension adds all products to the feed. There is a section on each WooCommerce product page that gives you the option to exclude the product feed.

This is a nice feature, but if you are like me and have a client that has 250 products and only wants to include 3 of those products in the feed what do you do?

I don’t want go through each product and click the exclude button. That would take forever!! Click To Tweet

I think a nice improvement to this extension would be to include a feature to exclude all products except the ones that you choose. Hopefully at some point Lee Willis the extension developer will add this.

Okay, so it’s kind of an ugly hack but this is how I resolved the issue for myself:

In your WordPress plugins directory open file: /plugins/woocommerce-product-feeds/woocommerce-gpf-frontend.php

On line 189 change:
if ( isset ( $tmp_product_data['exclude_product'] ) ) continue;


if ( !isset ( $tmp_product_data['exclude_product'] ) ) continue;
Now all products will be excluded automatically. If you want to include a product in the feed you have to go to the products page and check the “Hide this product from the feed”. It’s a little backwards, but at this point you could stop and it would work for you.

If you want to fix it so it makes sense from a users point of view you can open: /plugins/woocommerce-product-feeds/woocommerce-gpf-admin.php

On line 301 change:
echo '<label for="_woocommerce_gpf_data[exclude_product]">'.__(" Hide this product from the feed", 'woocommerce_gpf');


echo '<label for="_woocommerce_gpf_data[exclude_product]">'.__("Include this product in the feed", 'woocommerce_gpf');

The last thing you will have to do is remove the jquery slide reveal effect.

On line 334 to 344 delete:

Delete all of the code. It will be the code inside the javascript tags:
<script type="text/javascript">
jQuery('#woocommerce_gpf_excluded').change(function() {
if (jQuery("#woocommerce_gpf_excluded").is(':checked')) {
} else {

That’s it!! You have now changed the default to exclude all products. All you have to do now is go to the products pages you want to include and check the “Include this product in the feed”.

Remember that you are hacking the plugin/extension, so if you update it you will have to resolve this issue again.

I hope this helps.

Shawn Hayes

Team Share Web Design


  • Alex Timmer

    Good fix, though too bad it’s a core edit involved, something I’d rather not do. But this thread did get me on the right track to go figure out if I can set the “exclude this product from feed” option for all products via the database, and then changing it for the few products we do want to show.
    Quite a missed opportunity that there isn’t a global option for this, and that there IS some CSV-export functionality, but NOT for this specific exclude option..

    • Share Web Design

      Hi Alex,
      I totally agree!! I hate hacking plugins or anything core. I really wish the author would add this feature to the plugin. I am glad this helped you get on the right track though. Let me know if you have any questions about anything.

  • Rob

    Great Post – I have just downloaded the plugin and as like others can’t believe there is no default option to hide all products to start with. make sense to me.
    Anyway I was able to find the code on your first part (p189) even though it is further down and slightly different. The last two points that code is not where you say and anything similar to it is just too different to yours for me to risk changing. There is no reference to Javascript in the gpf-admin php file now.
    I understand there has probably been a lot of changes since you created this post and just curious if you have an updated version at all please?

    • Share Web Design

      Unfortunately no, I haven’t worked with the updated version. This was for version 3.5 back in November, 2014.
      Sorry about that.

  • Jitske

    I found your hack, but it seems that this file (/plugins/woocommerce-product-feeds/woocommerce-gpf-frontend.php) has changed. So I can’t use your solution.
    Can you help me with the latest version (6.8.0)?

    I have about 2500 products and I want only 10-20 in the Google product feed, so check the box for hiding the product would be quite a job;-)

    • Shawn Hayes

      I am really sorry you are in a bad spot. As mentioned in the comment above, I haven’t worked with the updated version. This was for version 3.5 back in November, 2014. If I do work with the new version I will definitely update the tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Posts


Facebook By Weblizar Powered By Weblizar