WooCommerce has a really nice feature that allows you to define default product variations for your variable products. I have to admit that it’s pretty awesome! But if you’d like to remove all default product variations at once, well that’s a bit complicate, especially when you have many products. There’s no easy way to do it from the administration, and doing it manually would take you a long time.
The only way to proceed is to perform a manual query, you can do it from PhMyAdmin for example. Please make a backup before playing with custom queries, you could mess up your whole site, and I don’t want to be responsible of that !
Here is the MySQL query to delete ALL default product variations:
DELETE FROM wp_postmeta WHERE meta_key =’_default_attributes’
Pretty simple right? But really useful!
Here is a quick method to localize with ease the jQuery UI datepicker fields on your site. The 1st thing you need to do is to access that page, and from there click on the language you want to apply to your datepicker fields. Let’s use French for this post. When you click on the jquery.ui.datepicker-fr.js link, here is what you see:
To add the localization to your WordPress install, we’ll hook this code to the wp_footer filter (the code below goes within the functions.php file in your theme folder):
And boom, all your datepicker fields will be localized into French! Well, of course you can improve that code, but the basis is here!
A few months ago I wrote a post on how to add custom fields to WooCommerce products within the administration, and many of you ask me how to add custom fields to products variations. So I decided to write this tutorial to help you create new fields for each WooCommerce product variation. The final result of this tutorial will look like this:
In WooCommerce <= 2.0.20, searching products by SKU in the administration used to be done using the “SKU:” prefix, but this was removed in version 2.1. You can now search by SKU without having to add the prefix in the search form. However there’s a little bug in versions 2.1, 2.1.1 and 2.1.2 in the function that returns only one single result while it should return all products having a SKU starting by a same prefix. This should be fixed in version 2.1.3, or 2.1.4.
As a temporary fix you can add this snippet to the functions.php file in your theme folder:
And then use the old search method (eg. “SKU: 7810″ will return all products having the SKU starting by 7810).
Sometimes when providing support for WooCommerce at WooThemes we have strange requests, and I got one recently that i wanted to share. It was about the orders date format in the administration. The default format is Y/m/d, and the customer wanted it to be d/m/Y. How to achieve this? Well, simply by using a filter and little function, here is the code to paste in functions.php in the theme folder to make this change:
And here is the result: