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

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

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 1.6.5.2 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

How to Use WooCommerce’s Lightbox

[stag_alert style=”grey”]Update: As of version 2.0, WooCommerce is no longer packaged with the excellent FancyBox (I guess due to some licensing issue or something). I’m leaving this article up for those still on WC 1.6.6 and previous, and for historical purposes. To learn how to make use of the new WooCommerce-2.0 compatible lightbox, read on in the new and updated article How to Use WooCommerce Lightbox Part 2[/stag_alert] WooCommerce comes with Fancybox, a Lightbox implementation,…

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