This tutorial will teach you how to create a Google product feed (for Google merchant center) using the products you have on your WordPress WooComerce store platform . You will be able to add the products from your woocommerce store to Google merchant centre, and have full control over the category of products they will appear on.

This tutorial is for all the people that do not want to purchase the Google Product Feed Plugin , from the WooCommerce store (or think that 50$ is a bit to much).
Free WordPress Plugin for Google Merchant

Getting products into google merchant

I will split this article into 3 sections :

  • Store Product feed Case study
  • Implementation
  • Further support

1. Store Product feed Case study
I had to design for a German client (dealershop24.de) an online store. They specialize in LED lighting solutions, so their products have a lot of technical specifications. Being used to wordpress, I decided to try to go for a ecomerce plugin that had the latest seo bells and whistles (microdata/rich snippets) so I went for woocommerce.
After all was set and done with the store, I realized that for the German market, google.de pushes a lot of “shopping results” right into the result page.Google recomends products on certain searches It’s the same with United States, Brazil, Canada, Italy, UK, Spain and a few more countries that for the sake of keeping this short I will not mention them here :). (my home country, Romania, is not one of them).
List of countries supported by google merchant

So what does this really mean ? Well it means that soon Google will show you results and prices from various “respected” stores or retailers, each time you search for a particular brand or product. Trying to always stay on the edge of SEO and Google’s crazy ideas (Google wave comes to mind) I decided to give Google Merchant a chance.
Getting your products into google merchant
My first question was how do I get “my store” listed there. The solution was simple enough, you just have to open an account. Everything is free as long as you are not from United State. (they need to pay in order to get their products shown in the result, but I have a feeling that soon enough we will all need to)
Product feed url
After I got my account id I was presented with an option to add a “new data feed”. After selecting my target country the format (googlebase) and a random data feed filename, I was left with a lot more questions than answers, like :

What format does the Google merchant data feed needs to be ?

It can be txt or XML (rss2 or atom) but I found that XML (RSS2) was the easiest to set up with the woocommerce store platform.

What information does the product feed need to contain ?
You will find additional information here : http://support.google.com/merchants/bin/answer.py?hl=en&answer=188494&topic=2473824&ctx=topic#other but keep in mind this is for an English store only !
There are country specific variables like ‘in stock’ is ‘auf lager’ for a German store, so you might need to consult your own version of that help file.
Keep in mind that Google_product_category and product_type are super case sensitive and MUST be chosen from a predefined list compiled by Google !

It’s a long list but here it goes :
id [id] – An identifier of the item
title [title] – Title of the item
description [description] – Description of the item
Google product category [Google_product_category] – Google’s category of the item
product type [product_type] – Your category of the item
link [link] – URL directly linking to your item’s page on your website
image link [image_link] – URL of an image of the item
additional image link [additional_image_link] – Additional URLs of images of the item
condition [condition] – Condition or state of the item
availability [availability] – Availability status of the item
price [price] – Price of the item
sale price [sale_price] – Advertised sale price of the item
sale price effective date [sale_price_effective_date] – Date range during which the item is on sale
brand [brand] – Brand of the item
gtin [gtin] – Global Trade Item Number (GTIN) of the item
mpn [mpn] – Manufacturer Part Number (MPN) of the item

Most of the data can be extracted from the Woocomerce store platform. (considering that you entered the information in the store)

2. Implementation of the woocommerce product feed

It’s pretty simple and straight forward :

a. You need to create your product feed and add some rewrite rules. For that you will need to add this to your theme “functions.php” file :


//Define the product feed php page
function products_feed_rss2() {
 $rss_template = get_template_directory() . '/product-feed.php';
 load_template ( $rss_template );
}
 
//Add the product feed RSS
add_action('do_feed_products', 'products_feed_rss2', 10, 1);

//Update the Rerewrite rules
add_action('init', 'my_add_product_feed');
 
//function to add the rewrite rules
function my_rewrite_product_rules( $wp_rewrite ) {
 $new_rules = array(
 'feed/(.+)' => 'index.php?feed='.$wp_rewrite->preg_index(1)
 );
 $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
}
 
//add the rewrite rule
function my_add_product_feed( ) {
 global $wp_rewrite;
 add_action('generate_rewrite_rules', 'my_rewrite_product_rules');
 $wp_rewrite->flush_rules();
}

Notice the “/product-feed.php” , you can change that to whatever you want as long as the file you will be using will have that name.

b. Create or upload a file called “product-feed.php” that has the folowing code in it : product-feed.php

'; ?>
 

>
 

    <?php bloginfo_rss('name'); wp_title_rss(); ?>
    
    
    Lichtschl?uche Lichterketten
    
    
    
    
    
     'product', 'posts_per_page' => 999 );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post(); global $product;
    ?>
    
        <?php the_title_rss() ?>
        
        
        price ?>
        neu
        
        is_in_stock() ? 'auf lager' : 'vorbestellt'; ?>
		LEDWorkx
		Heim & Garten > Beleuchtung > Leuchtmittel > LED-Leuchtmittel
        Heim & Garten > Beleuchtung > Leuchtmittel > LED-Leuchtmittel
		get_weight();?>
		get_sku(); ?>

        ]]>

        ]]>

 

    
    
    


Keep in mind that this product feed code was custom made for a German client (led shop) so you will need to change some things around like :

Lichtschl?uche Lichterketten 
 neu 
 is_in_stock() ? 'auf lager' : 'vorbestellt'; ?> 
LEDWorkx 
Heim & Garten > Beleuchtung > Leuchtmittel > LED-Leuchtmittel
 Heim & Garten > Beleuchtung > Leuchtmittel > LED-Leuchtmittel

description – it can be anything
condition – you must use the proper variables for your specific country (example for English: new, used
availability – you must use the proper variables for your own country (for English:in stock, out of stock)
brand – the brand of the product
product_type – Important ! use only the Google specified product categories that you can find here http://support.google.com/merchants/bin/answer.py?hl=en&answer=160081
Google_product_category– Important ! same as above

c. Access your product feed by adding going to http://yourStore/feed/products/
d. Specify the link to your product feed in your Google merchant account and on your webmaster tools under submit sitemap.
Products are in the google merchant center with no errors
e. You are all done. It may take up to 4 days for your products to appear (given there are no errors in the submission) in the Google products results.

3. Further support
To lazy to implement the woocommerce product feed by yourself

I will offer free advice and reply to your questions related to this article.
If you are unable to implement this free tutorial on how to get your woocommerce products listed in Google products, or you find this time consuming, I will do it for your, for a nominal fee of 25$ (just think of all the things you could do with that money, get a domain name for two years, feed a family of 5 ants for a whole year, get a half-decent host for 1 month, so don’t be lazy, don’t give me the money, I’ll probably use them to buy 5 packs of cigarettes that will last me exactly 3 days… ) :P




PayPal logo

For the time being I will only work on English/German product feeds. After you acquire my services I will contact you via email within 24 hours and either work remotely using a program of your choice or just set the files up for uploading and guide you step by step on how to submit the product feed.
I will issue a full refund :
– If my schedule is too full and I am unable to contact you within 48 hours.
– If for some strage reason I am unable to get the feed working
– If you are unpleased with the results
– If I don’t like you
– If you don’t like me :)
I have started working on a wordpress plugin that I will offer free of charge (donation ware) but I do not have an estimate on when it will be completed.
(I’m a SEO guy, and I chose SEO because I’m lazy so…)

PLEASE ALWAYS SKIP TO THE LATEST UPDATE

UPDATE 03.01.2013 thanks to Taye from Iphone 5 Adapter
Server issues while accesing the rss product feed for google merchant
NOTE ! Some servers (hosts) might not return the proper answer when requesting a feed
example http://web-sniffer.net/?url=http://www.appleiphone5adapter.co.uk/feed/&uak=9&type=HEAD returns a 404. you need to ask your web-hosting company if it’s possible to return a proper header during such a request.

You can test if your server is affected by this issue by going to http://web-sniffer.net filling in your domain name and adding /feed at the end. if you get a Status: HTTP/1.1 404 Not Found , you will not be able to submit your feed to google merchant. It does not matter if you can access it in your browser (it will show up on chrome), you will not be able to submit the feed.

A simple solution would be to go to your domain.name/feed/products by using google chrome as a browser, right-click, view source, and save the content of the source to a file, rename that file to products.xml and upload it to your domain root.

You can then use the yourdomain.name/products.xml file to insert your products into google merchant or just chose Manual upload and select the file you just created.

Keep in mind that this is not a real solution, since when you either change the prices, or add a new product, you will need to repeat the procedure. The real solution is checking with the server administrator of hosting for support. (just tell them that you need the server to issue a proper response whenever someone requests a rss feed)

UPDATE 31.01.2013 Thanks to Jane There might be some issues with maya woocmerce theme. Before giving up try testing with another theme. Use this as a reference. DO NOT DEPLOY the theme commercially as it is a premium theme. (the guy who designed it might come after you (in your sleep :P ) if he finds out.

UPDATE 11.02.2013 Thanks to John; If you experience issues with the maya theme (or other themes) related to the fact that the product feed is not accessible it can be one of two possible issues :
1. You can’t access the yourdomain.tld/feed/products/ in any browser (you get a 404)
FIX : you need to turn on permalinks in your wordpress install (under settings -> permalinks -> post name)

2. You can access the yourdomain.tld/feed/products/ in chrome but you can’t submit it to google merchant or access it in any other browser (you get a 404 response)
FIX : you need to post a “post” in wordpress, so that the rss feed system gets activated/generated. do that and your theme will issue the proper response (200) when your product feed is called upon by google merchant.

Update 14.02.2013 Finally had the time to write a plugin, you can download it free here Free Woocommerce Product Feed Plugin