Starting the “Blogging for Hippo” contest

Last year at WooThemes, we decided to create a small contest among WooThemes employees called “Blogging for Benjamin”. The aim was to write a blog post every single day during one month, and that was great! This year, Bryce and Barry decided to called it “Blogging for Hippo” (Hippo will be the mascot for the next WooCommerce main version). So, everyday I’ll be posting a new article, until december 24th, if I can ;-)

Why do we do this? Well, because we think it’s a great to motivate everyone in the team to create content for you guys! The rules are pretty simple, we must post everyday, and we *must* add an animated gif to every post (I don’t why, I think it’s because Bryce is just trolling us, again!). Each post must contain at least 250 words. And there’s nothing to win, just fun!

So, who is participating? For now:

I will definitely update that list when my WooThemes fellows will decide to participate in that contest. I’m pretty sure that Patrick Rauland will be in! (edit: Patrick joined the competition!)

So, that’s a great opportunity for you to let me know what you want to write about: WooCommerce? Custom Post Types? Taxonomies? Advanced queries? Just shout in the comments and I will listen to you and I’ll write stuff for you! Isn’t that awesome?

One last thing, please sure you follow other contestants sites, they are great resource for WordPress related stuff and don’t forget to follow the #bloggingforhippo hashtag on Twitter! So, let’s begin the Blogging for Hippo contest!

Oh and I was about to forget, here is the *required* gif:

Access WooCommerce Product Tabs Directly via URL

Here is a quick snippet that I wanted to do for a long time. The aim is to allow you to create custom URLs to access products page with a specific tab active. By default, when you access a product page, the “description tab” is active by default, but with this snippet you can open the reviews tab (for example) directly from the URL. Useful isn’t it?

To use is it, simply add the tab name after a #, for example:

Simple right?

To be able to use this method, simply paste the following code in the file called functions.php in your theme folder:

And guess what? It works no matter the permalinks structure is ;-)

Here is the result:


Too many wc_sessions in WooCommerce?

In some cases, you can see that your wp_options table is growing too fast and is becoming huge because of WooCommerce. If so, you can see that the sql table is full of _wc_session_xxx and _wc_session_expires_xxx entries. These can happen because of two things:

  • Cron tasks aren’t working on your site
  • A bot is crawling your site and creates sessions on the fly

Hopefully, in the latest WooCommerce versions there’s a tool to delete these sessions:


But sometimes, the database is so big, that the process fails because of the PHP max execution time, or because of a lack of memory. In that case you can use the following MySQL query directly in phpMyAdmin:

DELETE FROM wp_options
WHERE option_name LIKE '_wc_session_%' OR option_name LIKE '_wc_session_expires_%'

And finally, to avoid the wp_options to become so big, make sure that cron aren’t disabled on your site, to do so check if your install does NOT contain this line of code:

define('DISABLE_WP_CRON', 'true');

If so, remove it.

One last thing, if you want, you can add the following code to the .htaccess file to avoid bots to create sessions while crawling your site:

User-agent: *
Disallow: /*add-to-cart=*

WooCommerce Product Vendors: Display Vendor Details

WooCommerce Product Vendors is an awesome extension that adds to WooCommerce many features to help you create a whole marketplace like any Envato marketplaces (CodeCanyon, ThemeForest, GraphicRiver etc…), or Creative Market.

I have to admit I love that extension built by Hugh, one of my awesome fellows at WooThemes.

Today I’d like to share a little snippet that allows you to display vendors details within the “vendor” tab on the product page. By default the tab content is populated by vendor’s fields, but you can add more. For example to display the commission value use the following code:

Pretty easy right?

The final result: