WP e-Commerce SEO Tutorial

by Jason Capshaw on January 21, 2009

Check out the new Twentyten Ecommerce Theme

SEO Tutorial Overview

  1. Some SEO basics.
  2. Remove WordPress headline from “products-page”.
  3. Add h1 to item/product page.
  4. Add h1 element to Category/Group pages.
  5. Title tags and meta descriptions

SEO Basics

For those of you just getting your feet wet when it comes to SEO, there are a few basic on-site optimization fundamentals that should never be overlooked, especially if you plan on driving traffic from the search engines in a competitive market. There are three main factors, the title tag, the h1 tag and the inbound anchor text to your page for successful ecommerce seo.


It is important that each page have a unique title tag and h1 tag that closely match (contain the targeted keyword phrase). The h1 tag is often and mistakenly used in the logo and is not unique to each page.  In Google’s algorithm, any content in the h1 element is more important than any other content on the page. For more on the H1 tag you can read Scott Hendison’s explanation or checkout this SEO basics article (third step).

Removing The Products Page Headline Title

WP e-Commerce uses the page template in order to display all products. For example, the products-page will contain a list of products that you choose in the setup. When you click on a category/group, that category or group will be displayed inside of the wordpress products-page. It will send a string to the URL so it may look something like: site.com/products-page/test-category

Since the wordpress products-page is always present, the title (headline) for the page will remain no matter what category or product you are viewing and will say “Products Page”. Lets get rid of the page title for the products page so we can use h1 tags that are related to our products.

The Page/Post title is featured above the content and is displayed in the page.php template with something like this (this is your general wordpress theme, not the WP e-Commerce theme):

Lets tell wordpress to display the page title as long as the page is not the “Products Page”.

Add H1 Element To Items Page

Not to be confused with what WordPress calls the “Products Page”, this is the page where your individual products are for sale. For example the page would be:

site.com/products-page/example-category/another-test-product/

In products_display_functions.php on line 645 you will find the following code.

$output .= "

$special" . stripslashes($product['name'])."

\n\r";

Change the h2 elements to h1 elements.

      $output .= "

$special" . stripslashes($product['name'])."

\n\r";

You will need to play around with the stylesheet to get the look you want, I am not going to go to in depth into the design process here. But, In the iShop.css, look for h2.prodtitles and create another style with h1.prodtitles. If you use the same attributes, will get the same look as the h2 elements.

H1 Element On The Categories/Groups Page

You will need to edit the core WP e-Commerce files in order to get the h1 element included at the top of the categories pages. The category pages are sometimes referred to as group pages. It is important to name them with the proper keyword that you are targeting.

Open products_page.php in your favorite text editor. You will find the following code starting at line 63.

 if($_GET['product_search'] != null) {
					echo "".TXT_WPSC_SEARCH_FOR." : ".stripslashes($_GET['product_search'])."";
				} else {
					$category_image = '';
					if((get_option('show_category_thumbnails') == 1) && ($category_data['image'] != null)) {
						$category_image = "";
					}
					echo "".$category_image."".stripslashes($category_data['name'])."";

On line 64 replace the strong element with the h1 tag. Remember to replace the closing tag with it is well and leave the class=”cattitles” the same. Do the same thing on line 70 since it is an if/else statement.

This is how the code should look after you are done (you could just copy and paste if you like).

if($_GET['product_search'] != null) {
					echo "

".TXT_WPSC_SEARCH_FOR." : ".stripslashes($_GET['product_search'])."

"; } else { $category_image = ''; if((get_option('show_category_thumbnails') == 1) && ($category_data['image'] != null)) { $category_image = ""; } echo "".$category_image."

".stripslashes($category_data['name'])."

";

Title Tags And Meta Descriptions

The title tags and meta description hack was a little bit more involved. Most of it, actually all of it, is done outside of the WP-e-Commerce plugin. First of all, before you can test the description tag, make sure that your categories/groups have a description added to them, since this fix uses that content as the description tag for the category pages.

I built this script based on this one, I modified it to include a title tag for the products page itself. I also added the meta description capabilities.

The category pages function determines that it is indeed a category page, queries the database for the category name and puts it into the title tag. It also takes the first 150 characters of the category description and puts it into the meta description tag

The item (actual product) pages function does the same thing as the category pages function, except that it makes sure you are on the product page. It replaces the title tag with the product name and blog info (you need to edit script to put your blog info in). It also includes the first 150 characters of the first description in the meta description tag.

The title tag and meta description for the main products page(products-page) is added manually when you install the script. Simply, replace, “My Products Page Title” with the appropriate title tag.

I normally use a plugin to add the meta description tag, but that plugin conflicted with WP e-Commerce. So I am using SEO Title Tag and wrote the next part of the script to add the description tag. Basically, it simply adds the description tag to every page that is not on the products page by adding the first 150 characters of the post.

This goes into the main WordPress header template where your normal title tag would go.

".$productname." | site name
";
}
///////// Function to Find Category Name /////////////
function oGetCategoryName( $nicename ){
global $table_prefix;
$query = "SELECT name, description
FROM ".$table_prefix."product_categories
WHERE `nice-name` = '".$nicename."'";
$result = mysql_query( $query );
$row = mysql_fetch_array( $result );
$name = $row['name'];
$description = $row['description'];
//Category Title Tag and Description -- Change the name below to reflect your site
return "".$name." | site name
";
}
//this if state will determine if we are on the products page, the category page or the actual products page (item page) and call the appropriate function
if(get_the_title() == 'Products Page' ){
$pparts = explode('/', trim($_SERVER['REQUEST_URI'],'/') );
if( $pparts[2] != '' ){
echo oGetProductName( $pparts[2] );
}
else if( $pparts[1] != '' ){
echo oGetCategoryName( $pparts[1] );
}
//if we make it this far in the if statement, than we know that we are on the main products-page listing what you have for sale, manually edit this to reflect what you want the title tag to be and what description you want to use.
else {
?> your title tag for home

<?php if (function_exists('seo_title_tag')) { seo_title_tag(); } else { bloginfo('name'); wp_title();}
?>

Alright, you should be well on the way to a nicely optimized WP e-Commerce site.

{ 59 comments… read them below or add one }

siambookmark January 21, 2009 at 9:57 pm

thank you good

Reply

Jason January 22, 2009 at 6:41 am

I am glad you found it useful.

Reply

Tobias February 7, 2009 at 2:14 pm

hey. i think the beginning of the title tag code is missing, isn´t it?

Reply

Tobias February 7, 2009 at 2:22 pm

also, the two pieces of code for “Removing The Products Page Headline Title” are identical

Reply

Olivier @ Breast Pumps from Avent February 10, 2009 at 2:14 pm

Replacing the h2 tag with a h1 is indeed a cunning idea (as would the Blackadder say (this is from a British comedy series)) But indeed, we all should look into our templates to see whether there are these kind of little optimisations can we could profit from.
Thanks for the good advice.

Reply

butik online February 15, 2009 at 9:36 am

great tutorial. i used it. thank u

Reply

martial arts equipment February 21, 2009 at 1:38 am

Great,Thank you!
For keywords and description meta attributes,I like to use all-in-one-seo plugin,That’s great!

Reply

CharlieO February 26, 2009 at 6:06 pm

Brilliant little summary – thank you for sharing. I’m using AllInOneSEO plugin for meta and page titles too with no problems spotted yet.

The two snippets of code above for removing Products Page Headline Title are the same, as Tobias points out – I’d love to see that corrected if you have a spare minute. I don’t know how to write an if statement (?) to determine if it is the products page or not so might just strip all that code out for the time being!

Reply

Jason February 27, 2009 at 6:41 am

Sorry for the delay…I have updated both errors.

Reply

Tobias February 28, 2009 at 11:46 am

hey jason. thanks for the update, but i´m still getting an unexpected t_string error when Removing The Products Page Headline Title your way

Reply

Tobias February 28, 2009 at 12:11 pm

same for the meta-tag-fix. using wp 2.7 and wp ecommerce 3.6.8 rc 3

Reply

Jason March 2, 2009 at 5:34 am

@Tobias, I will post my complete header.php file for you to download later. I am not sure why you are getting the error and I will take a look at it.

Reply

Peter March 3, 2009 at 7:56 am

Tobias – have you perhaps renamed your products page?

Reply

jer March 7, 2009 at 9:30 pm

you should offer a paid service to do this. i could use the help. having nothing but problems with 2.7.1 :0(

Reply

zorito March 26, 2009 at 6:06 pm

beautiful blog merciiii

Reply

James March 31, 2009 at 10:08 pm

I am using all in one seo and wpremix for my blog them and I cannot change my header.php title tag. Is there any way this company is going to produce a plugin with built in seo features???

Reply

nick@ecommerce development May 4, 2009 at 7:10 am

SEO can be a daunting task to begin with, but adding SEO to an ecommerce site is even more difficult. I think you offer some great tips that everyone should take advantage of. Thanks for the write up!

Reply

nick@Advanced SEO May 4, 2009 at 5:56 pm

I have been having a ton of trouble getting my online store that uses wp e-commerce indexed properly. it gets very few visitors a day. your post makes alot of good points. im gonna implement just about everything you say here. ill let you know hoe it goes.

Reply

nick@ecommerce development May 18, 2009 at 6:56 am

You offer great tips. H1 tags are very important, what i think people forget is the fact that it should only be used one time per page. Use H2 or H3 tags if you need to, but using too many H1 tags is like bolding your entire paragraph… it looses its emphasis.

Reply

Ben May 20, 2009 at 1:56 am

In Fact, I am getting the t_string error as well. Would be great otherwise to have this code running well in my wp header.php file. I tried several times to paste this into my original header from wp default theme, 2.7.1 WP. Any editing to this php code please? I am otherwise all right to do such changes but in these regards it’s not working. With compliment and anticipation. Thank you very much!!!

Reply

techbreaking May 21, 2009 at 5:24 am

Cool tutorial. help me very much.

Reply

Adam@st louis brazilian jiu jitsu June 6, 2009 at 2:01 am

Hi,

I’m just new in this SEO thing. what is WP-e? I just bookmarked your website. hope to get an answer. thanks!

Reply

Andrew from sydney seo June 6, 2009 at 7:29 pm

well put together and very useful. Since fixing numerous sites using your guide we were able to see a jump in rankings for multiple websites. Duplicate descriptions and titles is a major issue for seo. Well done

Reply

Nikkatsu June 7, 2009 at 2:20 am

Having trouble with both my sites using this.

Unexpected T string.

Any help?
Please email me.

Reply

nikkatsu June 7, 2009 at 2:23 am

Can’t get this to work.

Unexpected T string.

I have 2 sites and get same error, can anyone help me?

Reply

Justin June 15, 2009 at 12:37 pm

Getting this error

Parse error: syntax error, unexpected $end in /home/cultcine/public_html/wp-content/themes/Black_Wood_0_1_1923/header.php on line 194

Line 194 has no code, so what’s the problem??

My products page is named (products-page) for some reason
and the code above doesn’t get rid of it in URL.

Can you please email me and help me out on this.?

Reply

Cem U?ur June 23, 2009 at 2:59 am

Hi, i am trying to add all products and related pages with products to sitemap.
i m using google-sitemap-generator plugin and wp-e-commerce plugin.
i can add manually all products to sitemap but i want to do it with codes.

do you have any idea?

Reply

complexity July 4, 2009 at 1:37 am

Missing a } at the end.

I haven’t figured out how to get descriptions working on a product page yet though.

Reply

jogja July 7, 2009 at 9:33 am

thanks, it is usefull tutorial…
Thank You

Reply

amy@toxic mold removal July 12, 2009 at 3:48 pm

Replacing the h2 tag with h1 sounds interesting. I will have to try it on one site and see how it effects search results for site. Some great ideas i am going to try one at a time on different sites.

Reply

Matthew July 16, 2009 at 12:06 am

Hi, I am trying to fix a silly problem in e-commerce where the meta tag for description says “[productspage]”

You didn’t mention this so I was wondering if following your changes will add a good description to each product.

Also when I try and copy/paste your code I get a number sign for each line.

Could we get it in a plain text file for easy copying.

Great article, thanks for your help.

Reply

Michelle July 27, 2009 at 8:50 am

Hi,

Is there a WP e-commerce theme that you would recommend that’s great for SEO and all ready has some of the info above in it?

Reply

Jason July 30, 2009 at 5:17 am

@Michelle, I do not. You will have to manually change the CSS files and HTML to make the themes SEO’d

Reply

Quality Banner Stands August 25, 2009 at 2:36 pm

Thanks for accompanying your code as well… it was easier to follow than other posts

Reply

mario September 1, 2009 at 2:09 am

syntax error also here….
does anybody have the correct version of scripts above?
I wonder why Jason have been so kind to spend his precious time in this post with so many interesting arguments for then leave it unusable for the people. (expecially for who uses latest releases where several files and paths have been changed)
It sounds to me so odd……

Reply

Jason September 2, 2009 at 1:09 pm

Mario…my fascination with wp-ecommerce is over. I have now switched all of my ecommerce to Magento. However, I do plan an addon soon to customize your seo stuff for wp ecommerce.

Reply

Juliawan September 13, 2009 at 7:48 am

maybe I can use that

Reply

Gautam@Oes Tsetnoc September 18, 2009 at 12:50 am

This is one of the best tutorial on optimizing the WP e-commerce!

Thanks!

Reply

Bryan October 12, 2009 at 3:54 am

It really surprised me in that thread that Dan from WPecommerce asked what a SERP was. If a WP programmer had even a little bit of SEO knowledge, we wouldn’t have to be modifying the php code. It would be built in.

I can’t even get any of the Sitemaps plugins to work on my site. Apparently product pages are built at runtime, which conflicts with the normal WP standard that makes nice looking sitemap pages.

Has anyone had success with a Sitemap and WPecommerce, or have a mod that makes them work. My sitemap indexes 5 pages of my whole site: Home, Checkout, About, Transaction Results, Your Account.

Thanks for the great article!

Reply

Jason October 16, 2009 at 9:24 am

@Bryan,

Ye….what are SERPS? Just kidding. That is actually kinda scary. I do not know of anything that would work for the sitemaps.

I would like to put together a group of developers to come up with a completely viable ecommerce option for wordpress.

Reply

Andrew Weisman October 25, 2009 at 4:14 am

Hi. Your entry was very helpful, to those who are working hard in increasing traffic, and dealing with seo. This could really help those beginners. I enjoyed reading it. This would be of help to me.

Anyway, do you know the next Google PR update?

Thanks. Nice website you got here..

Reply

Lisa December 28, 2009 at 2:45 pm

Hi there

Thanks for providing these tips!

I have looked and looked and the ‘Removing The Products Page Headline Title’ code still seems to look the same in the before and after?

Also, does Magento work with WordPress or is it a stand alone e-commerce where you build the website and the shopping cart in one?

Reply

Pop Up Banner Stands January 10, 2010 at 3:05 pm

remember folks not to use more than 1 h1 tag per page – i quite like “all in one seo pack” – allows you to manually enter seo info per page

Reply

Jonny@registry winner review January 11, 2010 at 4:45 am

It is cool, i have never mentioned css before, thanks for your guide.

Reply

Webdesign Roosendaal February 23, 2010 at 1:18 pm

Nice article, thanks! As you point out with your tutorial, the WP E commerce plugin is still a long way from being search engine friendly.

It’s a shame most developers don’t pay any attention to these little details. It’s all so obvious, right?

Reply

Custom Name Badges February 25, 2010 at 10:24 am

css is nice! thanks for post

Reply

Dhany@Belajar SEO March 12, 2010 at 12:34 am

Hi Jason,
Thanks for sharing the tutorial. It’s easier to discern with the codes you provide.

Reply

Viktor@Bestimweb24.de SEO March 18, 2010 at 12:12 pm

Quite interesting is the whole thing with H1 tags to happiness makes the Joomla automatically, in the meantime it has überhollt the WordPress blog, I do not mean that WordPress is the wrong, but that it’s just a lot to adapt, then one has the perfect customized in terms of SEO be very happy about that.

Reply

edwin March 25, 2010 at 8:03 am

thank you for this great tutorial. i just build an e-commerce site, I’ll try it.

thank you

Reply

Ibogaine April 13, 2010 at 1:06 am

Thanks for providing such an informative tips. As I am a beginner, it will really help me a lot . This is really one of the best tutorial which I found very helpful to all of us.
Thanks and keep posting these types of tutorials.

Reply

Powerplates May 6, 2010 at 12:56 am

I found this tutorial very informative. You have posted such a useful article. It’s really helpful for the readers. I must appreciate your hard work which you shown in this post. Thanks ans keep posting stuff like this.

Reply

Ibogaine Treatment June 5, 2010 at 2:22 am

Thanks for providing such a nice and useful website. This is one of the best blog which I have ever found on the net.

Reply

irma June 15, 2010 at 1:18 am

why many people say it getting error .. ? is it really doesn’t work…?

Reply

Bestimweb24 June 22, 2010 at 2:00 pm

A rather long instructions in my view, what would it be with the plugin All in One SEO Pack which I had in my blog einsatzt with the WordPress plugin shop, it all works together beautifully without any problems.

Reply

hicalcium September 30, 2010 at 4:19 am

Hello, It’s excellent to see sites with google and thanks for the share that you’ve given. Commonly, I’m really amazed, but etc.

Reply

wealthyaffiliate October 8, 2010 at 2:32 am

My friend recommended your blog after subscribing to your RSS feed, now I see why. Keep up the good work, information like this doesn’t come around too often!

Reply

Steve C April 4, 2011 at 9:57 am

If it helps, I wrote a simple plugin for meta titles, descriptions and keywords for products.

http://labs.clark-studios.co.uk/

Reply

ambien May 21, 2013 at 4:46 am

The post offers confirmed beneficial to me.

It’s quite helpful and you really are obviously extremely experienced in this region.
You get popped my own sight to be able to varying views on this
subject together with interesting and reliable written content.

Reply

http://www.youtube.com/watch?v=_8jo8kU-7kA October 8, 2013 at 11:35 pm

Wow, wonderful blog layout! How long have you been blogging for?
you make blogging look easy. The overall look of your web site is great, let alone the content!

Reply

Leave a Comment

Previous post:

Next post: