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

How to Add Dimension Units to WooCommerce

This post was prompted by a recent question on the blog regarding how best to add custom units to the WooCommerce dimensions or weight options. While not a difficult thing to do, adding units is not trivial either if you don’t have much experience with PHP, WordPress or WooCommerce. This would be useful for adding, for instance, the foot as a dimension measurement to WooCommerce, which seems to be the most glaring omission. I’m guessing…

Read More

WooCommerce Order Admin Calc Line Totals

Compatibility Notice: The following article and code applies to pre-WooCommerce 2.1 only. It is not compatible with WooCommerce 2.1+ As of version at least, WooCommerce does not provide a way to automatically calculate the Line Subtotal and Line Total values for a given product quantity, when creating or updating an order through the Order Admin: As shown in the above image, there’s a button to calculate the line taxes for the order items, as…

Read More

WooCommerce reviews + tutorials

Override WooCommerce Template File Within a Plugin

The goal of this article is to describe one approach to overriding WooCommerce core template files within a custom plugin, such that they can still be overridden by a theme in the typical way. Note that this is similar to but solves a slightly different problem than what we did to create a custom overrideable woocommerce template file in your custom plugin. Overriding a core template in your plugin is something you might want to…

Read More

Ask SkyVerge

Hide WooCommerce "Free" Price Label

A common WooCommerce question lately has been how to hide the “Free” price label in the product/category/shop pages. Thanks to WooCommerce’s judicious use of filters/actions, this is very easy request, yet if you’re new to WordPress/WooCommerce you might not necessarily know exactly where to look. Well look no further, because here’s an easy way to suppress that “Free” notice for regular/variable products: add_filter( ‘woocommerce_variable_free_price_html’, ‘hide_free_price_notice’ ); add_filter( ‘woocommerce_free_price_html’, ‘hide_free_price_notice’ ); add_filter( ‘woocommerce_variation_free_price_html’, ‘hide_free_price_notice’ ); /**…

Read More

WP Development

Extending the WordPress XML-RPC API

The purpose of this article is to describe the WordPress XML-RPC API, explain how to use it, and demonstrate how to extend it to create custom API methods for interacting programmatically with WordPress. I assume a relative unfamiliarity with XML-RPC in general, WordPress XML-RPC, and spend time first covering the basics, if you want to skip straight to the section on extending the WordPress XML-RPC API, feel free to. What is XML-RPC? As defined by…

Read More