All posts by

Ask SkyVerge: How Do I Sort WooCommerce Order Items Alphabetically?

This week’s “Ask SkyVerge” question comes from Adrian, who wants to know: Can you sort the items in the order alphabetically? Ex: if someone orders broccoli, cabbage, string cheese Can your organize the items in the order alphabetically? Well, depending on where you need the items to appear sorted, you sure can! First, the code, which can be dropped into your current theme’s functions.php if you like: Which will give Keep Reading…

How to Use WooCommerce 2.0 Lightbox

WooCommerce 2.0 comes with prettyPhoto, a Lightbox implementation, bundled as part of the core. It’s used on the product pages to display the image gallery pictures, and a common question is “How do I use WooCommerce’s lightbox to do X”. This article will walk you through how to do just that. Enable Lightbox The first step is to ensure that the Lightbox is enabled by going to WooCommerce > Settings Keep Reading…

Translating a WordPress Plugin on the Command Line Step by Step

The purpose of this article is to provide a quick and easy to follow step-by-step guide to extracting text strings from a WordPress plugin for translation from the command line. Although this is documented in the codex: I18N for WordPress Developers and Translating WordPress, those articles are somewhat lengthy and the first time I was asked to internationalize a plugin it took me some time to find the actual steps Keep Reading…

Add Custom Options to WooCommerce Settings

This question comes in from blog reader Wilgert (thanks Wilgert!): could you help me find some simple code to add a custom option field to the general settings tab of the woocommerce admin area? Trying to avoid re-inventing the wheel here. Well, this may be more than you bargained for, but here we go! The WooCommerce settings can be found under the menu item WooCommerce > Settings and look like Keep Reading…

WordPress Get DB Table Column Names

To get the column names for a MySQL database table in WordPress, use the following: global $wpdb; $table_name = $wpdb->prefix . ‘posts’; foreach ( $wpdb->get_col( “DESC ” . $table_name, 0 ) as $column_name ) { error_log( $column_name ); } Which will result in something like the following being printed to your debug.log: ID post_author post_date post_date_gmt post_content … You get the idea

Guide to Migrating Your Plugin to WooCommerce 2.0

With the release of WooCommerce 2.0 becoming more imminent (well, maybe not quite imminent yet, but certainly drawing nearer), those of us with WooCommerce plugins need to start work on getting them ready for the big release. WooCommerce has never been one to hold back on making plugin-busting implementation changes with a new release, and they’re setting the bar quite high with 2.0. It’s chalk full of code changes and Keep Reading…

Tweaking the WooCommerce Order Admin: Searching For Custom Fields

The WooCommerce Order Admin allows you to search for ordres by the following fields: order key billing first name billing last name billing company billing address 1 billing address 2 billing city billing postcode billing country billing state billing email billing phone order items But what if you want to search by another order field? Perhaps the order total? Well it’s as easy as adding something like the following to Keep Reading…

How to Override WooCommerce Widgets

While it’s not technically possible to override a WordPress widget (and remember WooCommerce widgets are nothing more than WordPress widgets), WooCommerce is just so extendable and pluggable and flexible, that some widget functionality can be nearly completely overridden just using the standard WooCommerce template files and/or template functions. For the widgets that aren’t as pluggable, or if you need greater control, you have the option to un-register a core WooCommerce Keep Reading…

Don’t Share Terms Between WordPress Taxonomies

By default WordPress will reuse terms with the same name and slug between different taxonomies (at least for now). For instance, if you add the term ‘red’ as a tag, and then add the category ‘red’, the same wp_terms record will be shared between them. This is also true for any custom taxonomies you define (remember that despite their seeming differences, WordPress tags and categories are both implemented as taxonomies). Keep Reading…