Here is a collection of tips, snippets, customizations and how-to tutorials to answer your biggest WooCommerce questions, curated by Rodolfo Melogli.
Please remember feedback is vital and that your social media shares, blog comments and WooWeekly newsletter sign ups help me understand which WooCommerce content works and which not, so that I can fine-tune my writing :)
Thank you in advance and enjoy!

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

Sometimes, cool things don’t apply to certain businesses. Also, keeping the default WooCommerce behaviour might slow down your website, should you not need to use a specific functionality.
For example, I’m talking about the new “Featured Image Zoom”, introduced by WooCommerce a while ago. What if your customers don’t need this? How can you disable it?
Well, as usual, this can be done with a few PHP lines! Now go and disable all the stuff you don’t need 🙂
Continue reading WooCommerce: Disable Zoom, Slider & Lightbox @ Single Product

We already studied how to detect if a product ID is in the cart – but if you take a look at the comments many of you were asking how to detect product categories.
So, today we’ll do exactly that. You can disable shipping rates, payment gateways, you can print messages, you can apply coupon programmatically… there are lots of things you can do “conditionally”, based on whether a given product category is in the Cart or not.
Continue reading WooCommerce: Check if Product Category is in the Cart

This is a nice follow up from last week’s snippet “WooCommerce: Slashed Cart Subtotal if Coupon @ Cart“, where I showed how to display original/discounted cart total on the same totals table row.
This time, I want to let users know the original and discounted cart item (product) amount after a certain coupon is applied. Who knows – this might improve your Cart U/X 🙂 Continue reading WooCommerce: Display Cart Item Subtotal With Coupon Discount

This is a nice snippet to let users know what the original cart amount was by slashing the cart subtotal and showing the cart subtotal after discounts on the same line (Cart totals > subtotal).
You can then hide the coupon code line if you wish!
Continue reading WooCommerce: Slashed Cart Subtotal if Coupon @ Cart

In the past, WooCommerce Cart and Checkout pages used to show “$0.00” beside each free shipping rate. Now, this is gone and WooCommerce only shows the shipping rate name, without the 0 amount.
But given that many freelance clients requested this customization, today we’re bringing this back to life with just a few lines of PHP. Enjoy!
Continue reading WooCommerce: Display $0.00 Amount For Free Shipping Rates

You’re filing your tax returns and need to know how much you earned in each state… but then find out WooCommerce doesn’t give you this calculation by default within its reports!
Don’t worry – today I’ll share a quick snippet so that you can calculate the amount you need in a second. Feel free to change the year, the country and the states in the snippet.
Continue reading WooCommerce: Calculate Sales by State

Storefront is a free theme (with 100,000+ active install), developed & designed by WooCommerce Core Developers. I’ve put together a list of snippets so that you can quickly and easily customize your Storefront Homepage.
Continue reading Storefront Theme: How to Customize Homepage Layout

While working for a freelance client I had to “detect” the cart item categories in order to apply some PHP customization.
So I thought – why not share with you how to display product categories in the Cart and Checkout? This adds a nice touch to those two vital pages, and prints a list of product categories under each cart item.
Also, I’m glad to introduce you to the amazing world of “wc_get_product_category_list“, a very handy WooCommerce PHP function!
Continue reading WooCommerce: Display Product Categories @ Cart & Checkout Pages

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: Per-Product Terms & Conditions @ Checkout

You may need to add some “personalization” to your WooCommerce website homepage. For example, you could print a custom greeting based on the user’s IP address.
For that, you can use PHP and WooCommerce inbuilt MaxMind Geolocation integration (when enabled from the General Settings Tab, of course).
Detecting the current user country could be very useful for other tasks, such as disabling payment gateways and shipping methods, printing country-specific content and so on. Enjoy!
Continue reading WooCommerce: Detecting Current User Country (Geolocation)

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 for free – nice! Needless to say, a comment and a social media share are much appreciated. Enjoy!
Continue reading WooCommerce: Order a “Free Sample” @ 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

The default WooCommerce Add to Cart “Quantity Input” is a simple input field where you can enter the number of items or click on the “+” and “-” to increase/reduce the quantity.
A freelance client hired me to turn that input into a “Select” drop-down. For their audience and UX requirements, it makes sense to let their customers choose the quantity from a drop-down instead of having to manually input the number.
Online there are complex snippets, but I decided to make things easier. The WooCommerce function responsible to generate the quantity input is called “woocommerce_quantity_input“.
Luckily, it’s a pluggable function – which means we can simply add this exact same function name to our child theme’s functions.php to completely override it. Enjoy!
Continue reading WooCommerce: Change Add to Cart Quantity into a Select Drop-down

Here’s the story: I’m working with one of my freelance clients and I need to show certain content in the Checkout (a product-specific “Terms and Conditions”) if such product is in the Cart.
Now, I’ve always looked for products in the Cart by “looping” through the Cart with a foreach (here, for example: Apply a Coupon Programmatically if a Product is in the Cart). But as I said, after some random research, I found out about another magic WooCommerce function: “find_product_in_cart()“. Which means finding a product in the Cart doesn’t require custom loops or complex PHP… it’s just a “one liner”. Enjoy!
Continue reading WooCommerce: Check if Product ID is in the Cart