WooCommerce: Check if Product Category is in the Order

We already saw how to check if a product category is in the cart, if a product ID is in the cart, and if a product ID is in the order… now it’s time to complete the series with the latest addition!

For this client, the scope was to do something on the “Thank You” page if a certain product category was purchased. For example, echo a “Thank you for becoming a member!” image in case the category “membership” was in the order.

Here’s the snippet, together with PHP comments so that you can understand how this is done. Enjoy! Continue reading WooCommerce: Check if Product Category is in the Order

WooCommerce: Display Product-Specific T&C @ Checkout

A freelance client sells two distinct products on the same website: a membership and an online course. Two different audiences, different formats and… different Terms & Conditions.

The goal was therefore to display the “Terms & Conditions” checkbox on the Checkout page based on the product in the cart. Once again, we’re going to use Conditional Logic. With that, the snippet is pretty easy to code! Continue reading WooCommerce: Display Product-Specific T&C @ Checkout

WooCommerce: Order a “Free Sample” @ Single Product Page

Recently I was on a coaching call with a client and the “Free Sample” challenge came up. Client has 400+ products on the website and had no intention of adding a free variation to each product manually.

So, I promised to myself I was going to study a different approach. And today you get it completely free. Needless to say, a comment and a social media share are much appreciated πŸ™‚ Continue reading WooCommerce: Order a “Free Sample” @ Single Product Page

WooCommerce: “Continue Shopping” Button @ Single Product Page

A freelance client hired me a while ago to display a “Continue Shopping” button on the Single Product Page, next to the Add to Cart. A simple way to send their users back to where they were coming from without clicking the “previous” button on the browser πŸ™‚

Here’s how it’s done, featuring an awesome WordPress function called “wp_get_referer()”! Continue reading WooCommerce: “Continue Shopping” Button @ Single Product Page

WooCommerce: Easily Get Product Info (ID, SKU, $) from $product Object

I’ve been wanting to publish this guide for a long while. As a freelancer, every day I repeat many operations that make me waste time – and one of them is indeed “How to get ____ if I have the $product variable/object?”.

For example, “How can I get the product SKU”? Or “How can I get the product short description”? Or maybe the product stock level, shipping class, tax class, price, regular price, sale price, and so on… hopefully this article will save you time πŸ™‚ Continue reading WooCommerce: Easily Get Product Info (ID, SKU, $) from $product Object

My Take on WooCommerce.com Switching to 100% Renewals

WooCommerce.com is dropping its 50% extension renewals, and moving to a 100% renewal business model.

I found this out at WCEU 2017 and then via WP Tavern. Unfortunately, this announcement is not on WooCommerce blog, on its social media channels or even Automattic.

And yes, this is retroactive – we are now all paying 100% renewals. So, let’s see what I think about this “still not official” news. Continue reading My Take on WooCommerce.com Switching to 100% Renewals

WooCommerce: Shipping by Weight (Without a Plugin!)

Woo 2.6 introduced Shipping Zones – and with that we can play with simple PHP to accomplish lots of “advanced” shipping rules, such as shipping by weight.

With many of Business Bloomer fans always asking for this sort of customization, today we’ll see how to do just that. Without the need of just another plugin πŸ™‚ Continue reading WooCommerce: Shipping by Weight (Without a Plugin!)

WooCommerce: How to Setup Tiered Shipping Rates by Order Amount

The new shipping zone management that was introduced with Woo 2.6 gives us the chance to add flat rate, free shipping and local pick-up methods by default.

But what if a client requires 3Β different rates depending on the order amount (tiered shipping)? For example:Β “For orders up to $100, shipping = $5; for orders up to $250, shipping = $2; for orders above $500, shipping = free”.

Is this possible without using a plugin? Well, the answer, as usual, is absolutely yes! Continue reading WooCommerce: How to Setup Tiered Shipping Rates by Order Amount

WooCommerce: Enable Payment Gateway Only for “Order Pay Checkout”

I invoice clients via WooCommerce, and then send them the “Invoice Email”, which takes them to the “Order Pay” page. Of course, I want to give them the option to pay via “Bank Transfer” (bacs), but I don’t want this to be visible on the default checkout page.

We’ve seen in the past how to disable payment gateways given certain conditions… but how do we “enable” one? Here’s a snippet for that – enjoy!

Continue reading WooCommerce: Enable Payment Gateway Only for “Order Pay Checkout”

WooCommerce Visual Hook Guide: Emails

WooCommerce Customizers: the Visual Hook Guide is back πŸ™‚

Here’s a visual HTML hook guide for the WooCommerce Emails. This visual guide belongs to my “Visual Hook Guide Series“, that I’ve put together so that you can find WooCommerce hooks quickly and easily by seeing their actual locations.

Let me know in the comments if this resource it’s helpful and how! Also, if you’re eager to learn how to use this guide, how to customize emails AND how to make sure your customization only affects one email type (e.g. only the Customer Processing email), take a look at this free video lesson.

Enjoy πŸ™‚

Continue reading WooCommerce Visual Hook Guide: Emails

WooCommerce: How to Add a Custom Checkout Field (PHP)

A client of mine runs online courses for acupuncturists via Sensei LMS. US Law requires an “Acupuncture Registration Number” in order for students to get the final online certificate. So, this task was a little bit more complex than usual as it had two major issues:

1) This new checkout field does not belong to billing or shipping (order information), but instead it’s a unique user field that needs to be saved and retrieved multiple times if necessary

2) This field does need to be shown at checkout only if a certain product category is in the cart (“online courses”, as opposed to e.g. “books”)

So, here’s how you do it – hope it helps you understand that anything is possible via PHP! Continue reading WooCommerce: How to Add a Custom Checkout Field (PHP)