When you add a hidden product to Cart, either manually or programmatically, this will be displayed in the Cart, Checkout and Order details pages (I’m not sure why a hidden product behaves like that… but thankfully you can hide hidden products from the Cart/Checkout/Order page with this snippet).
Problem is, even if you hide hidden products from the Cart page, the “Mini-Cart” product counter icon or text (it depends on your theme) will still count them as products (see the screenshot below). So the question is: in conjunction with the snippet aforementioned, how do I exclude hidden products from being counted in the “menu cart” (also called Mini-Cart Widget)? Continue reading WooCommerce: Exclude Hidden Products from Mini-Cart Counter
If you sell downloadable/virtual products and need to simplify your WooCommerce checkout when such product type is in the Cart, you’ve come to the right place!
Here’s a simple snippet to check if there are only “virtual” products in the Cart and if yes, all the billing fields and order notes are hidden (but name and email address). Go test this on your development environment and let me know if this works! Continue reading WooCommerce: Hide Checkout Billing Fields if Virtual Product @ Cart
Less is more (sometimes). On this same website, I’m already forcing max 1 product in the Cart and automatically redirecting users to Checkout upon add to Cart. On top of that, I’ve disabled WooCommerce cart fragments for performance reasons.
As a result, I definitely don’t need the whole “Mini-Cart Widget Dropdown Content”. To test, try to “hover” onto the shopping cart icon on the top right, and you’ll notice there is no cart dropdown.
Well, this is how it’s done – I love when a complex thing is fixed with one simple line of PHP!
Continue reading WooCommerce: Remove Mini-Cart Widget Dropdown
We’ve already seen how to add a product to cart automatically when a user enters your website. However, I needed a different functionality on this same website, and specifically I wanted a product added to cart only when a user like you visits a specific WordPress page ID.
If you wish to test, go to my free video tutorial page called “How to Customize the WooCommerce Single Product Page“. As soon as the page loads a product is magically added to cart, so that the WooCommerce Checkout on that same page is populated with the hidden item. If you go to my Cart page right after visiting that landing page, you can verify there is a product in there.
So, how did I do it? Continue reading WooCommerce: Add Product to Cart When Visiting a Specific Page
The “Shipping Calculator” can be enabled via the WooCommerce settings in order to give the user a way to calculate their shipping fees before getting to the Checkout Page. Usually they fill out the country, state, city and postcode form fields and click on “Update Totals” in order to calculate the shipping.
However, what if you only calculate shipping based on country? Or what if you only charge by zip code / postcode? In this case, you will need to hide the input fields you don’t need, and make UX better.
Well, here are some WooCommerce filters you can use from WooCommerce version 3.4 onwards to hide the fields you like (apart from country, which is mandatory).
Continue reading WooCommerce: How to Hide “Shipping Calculator” Fields @ Cart
Your WooCommerce shopping cart might look messy when it contains many products. Your specific business, besides, might require you buy “Part 1” first and “Part 2” after.
A way to tidy up the WooCommerce shopping basket is – for example – to sort products based on their title, from A to Z. As usual, this can be done with a few lines of PHP, even if you have no clue about coding… feel free to copy, paste, and enjoy the snippet 🙂
Continue reading WooCommerce: Sort Cart Items Alphabetically A>Z
There is a lot of literature online that solves this UX problem – so in this article let’s see if I can give you a simplified, working, updated version.
So, do you hate the “Update Cart” button too? Yes, the one you have to click after you update the quantity of a product in the cart…
Well, you’re in the right place: a simple PHP function, two lines of JQuery, one line of CSS and the result is pretty straight forward!
Continue reading WooCommerce: Automatically Update Cart on Quantity Change
I’m pretty sure that during one of those Black Friday sales all you wanted to do was to apply a bulk discount to your WooCommerce products without having to generate a coupon code.
Let’s not forget that despite coupons are trackable and you can assess your marketing efforts with their usage statistics, requiring the user to take one additional step at checkout (entering the correct coupon code) reduces your sales conversion rate (the same applies with useless checkout fields by the way – less work to do, higher conversion rate).
In today’s post, we’ll see what are the 3 options I recommend in order to apply bulk store discounts. It pretty much depends on your product types (simple vs variable for example) and whether you want to do this via the settings or with a little bit of PHP.
Continue reading WooCommerce: How to Edit Product Prices in Bulk?
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
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 sharing with you how to display product categories in the Cart? This adds a nice touch to the Cart page 🙂
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 Categories Under Product Name @ Cart
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.
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
Let’s talk about checkout UX: if a user is willing to pick up the item in store, why should there be a shipping form on the checkout?
Well, let’s see how we can hide this dynamically with a bit of PHP and JS!
Continue reading WooCommerce: Hide Shipping If Local Pickup Is Selected
Here’s a very simple snippet that achieves a very complex task – what if you wanted to force your Cart to charge a deposit or a fixed fee, no matter the product price?
Well, thankfully WooCommerce is pretty flexible and a lot of workarounds can be found. In this case, forcing the checkout to a fixed amount (e.g. $100) is as simple as applying a negative “cart fee” to make the total become $100.
Sounds like Japanese? Great – here’s why you’re on Business Bloomer. Copy the snippet, apply it to your test WooCommerce site and see the magic happen – without knowing anything about coding! Continue reading WooCommerce: Force Cart to Specific Amount (Deposit)
Quite an interesting snippet this is! A client needed to show EACH quantity of the SAME product as separate lines (cart items) in the WooCommerce Cart & Checkout page.
At some stage, you might need that too – for different reasons maybe. So, let’s see how this is coded 🙂 Continue reading WooCommerce: Split Cart Items When Product Quantity > 1
Yes, there are many plugins that already achieve this. But my goal at Business Bloomer is to save you from plugin conflicts, delicate updates and to make you learn some PHP 🙂
So, here’s how you can add, with a few lines of PHP, a minimum, maximum, increment and starting value to your Add to Cart quantities on the single product and cart pages. Who knew it was this easy?
Continue reading WooCommerce: Edit Add to Cart Min, Max & Step Quantity
Interesting, isn’t it? This has been on my to-write list for ages, so today I want to show you my first attempt at turning the Shop page into a list/table of products.
Let’s see how I did this – I will try to comment my PHP as much as possible so you can understand my strategy. Enjoy!
Continue reading WooCommerce: Display Products in a Table Order Form