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: http://mysite.com/my-product-name#reviews
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
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:
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:
Just a quick post to let you know that I was interviewed by WPmarmite a few days ago. Pretty happy with the result, so thank you Alex for taking the time to asked me questions about WooThemes, WooCommerce and CodeCanyon!
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:
As you know I work for WooThemes, the (awesome) company behind WooCommerce, as a full time support technician. And today is a great day because we hit 4 fucking million downloads! Wow! What a milestone right?
Joel wrote a nice post on WooThemes blog to explain how stats went crazy in just a matter of months. I really recommend you to have a look at that post, you will learn how WooCommerce became the most popular e-commerce in the world with about 18% of the marketshare.
Also, I’d like to tell you something. In november, WooThemes will be organizing the WooConf, a WooCommerce related event in San Francisco. And we offer a free ticket to attend this awesome event, including flight and accommodation. To enter the competition and win this free ticket, visit that page.
Still not using WooCommerce? Well, I guess it’s time to change!