Typically with eCommerce payment is collected, well, electronically. Sometimes though, you need to collect cash in hand, which is why WooCommerce comes with the Cash on Delivery gateway.

Typically if this gateway is used with WooCommerce Bookings, the bookings created will sit in an Unpaid status until they are manually updated by the store admin. Where this works for some, it does not work for all. So here comes the star of this post, the snippet:

This snippet takes code straight from Bookings itself and processes orders a second time only if they have COD as their payment method. It will put the associated bookings into a Confirmed status automatically. It also includes a filter to check to make sure the booking hasn’t already been set to Paid or Completed to make sure those statuses stay intact.

Hey kiddos! It’s been awhile, sorry about that!

Today we have a snippet that can be useful to so many people for different reasons. This one will add a BCC to emails you specify in WooCommerce, and here it is:

The emails you’d like to have the BCC added to are set in the $add_bcc_to array. There are a couple other examples that are already there. 99.9% of the time it’s really easy to get this name from the email settings in WooCommerce. Just go to the email settings for the email you want, then grab everything after _email_ in the address bar. In the below example we want customer_renewal_invoice:

screen-shot-2016-10-31-at-13-25-19

You, of course, need to update your email address, as well.

There are many instances where you may have virtual products in your store, or even every product may be virtual. There are snippets and plugins out there that cater to all orders, or certain orders… and this is just going to be another one of those.

This one will go through each line item in a new order, check that line item to see if it is a variation or a product, then check to see if that variation or product is virtual or not. If one line item in the order is not virtual, it exits. However, if every line item in the order is virtual, it sets the order to completed status.

Have fun, kiddos!

I had an interesting question come up earlier, I was asked why WooCommerce didn’t charge sales tax even though everything was set up correctly.

Let’s say the zip code entered for tax was 34480, and the tax rate is 6%. So, when you test, you enter in 34480 and the tax is calculated. What happens if you have a clever customer that enters in their full zip code with the additional four digit code, like so 34480-7107? WooCommerce will charge no tax.

Why? Well, to put it simple, it didn’t match. The way around this is when you’re entering in your zip codes, enter them in with a * on the end, like so 34480*. Tada!

Update: Version 1.6.3 of Memberships now includes a filter so that if you’d like to modify the query, you can. The first gist shows the filter as it is in the code, and the second gist has been updated to use the filter to reorder the posts by title.


Wow, that’s a long title.

So, I came across this issue today and I only saw a somewhat simple, but complex way to fix it. The problem is that when using WooCommerce Memberships, the content in the┬áMy Membership Content page is ordered in the default WordPress order of newest to oldest. After looking through the code, I understood why, but I’m not getting into that.

What I will get into is how to somewhat order this according to what you may need. The gist below contains a function that will edit the query for the posts and order the posts by title (a-z).

More information on how to modify WP_Query would need to be read up on in the WP_query section of the WordPress Codex.

As of right now, and version 1.6.1, it works. It may be updated in the future to be a little more user friendly, though. It has officially been updated to be more user friendly.