How to Add a Custom WooCommerce Email

WooCommerce 2.0 introduced a lot of new features to the core plugin, one being a new class-based implementation for emails. This makes it really easy to add your own custom email types to WooCommerce. In this article, we’re going to create a sample custom email that’s sent when an order with expedited shipping is received. A lot of larger sites disable new order emails if they receive a lot of orders, but most will still…

Read More

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 > General > Styles and…

Read More

WordPress development tutorials

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 to generate my POT file….

Read More

Ask SkyVerge

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 so: Like a lot of…

Read More

WordPress development tutorials

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 🙂

Read More

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 improvements plugin developers must be…

Read More

Tweaking the WooCommerce Order Admin: Searching For Custom Fields

The WooCommerce Order Admin allows you to search for orders 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 your themes functions.php: function woocommerce_shop_order_search_order_total(…

Read More

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 widget and subclass it, or…

Read More

WordPress development tutorials

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). Now, in general this is…

Read More