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
When talking about UX, or for very specific WooCommerce shops, you might need to “communicate” to the user a product is already in the Cart before re-adding it or increasing its quantity from the Shop/Category/Loop and Single Product pages.
The “Add to Cart” button label comes with a filter (actually 2 filters, one for the Single Product page and another for the other pages such as Shop), so all we need to do is targeting those two, “filter” the label text in case the product is already in the Cart, and return that back to WooCommerce. If this looks like Japanese to you don’t worry – simply copy/paste the snippet below! Continue reading WooCommerce: Rename “Add to Cart” Button if Product Already @ 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
It’s Black Friday / Cyber Monday weekend and I’m pretty sure many WooCommerce entrepreneurs would love to apply a bulk 30% discount on their website without having to generate a coupon code.
Let’s not forget that despite coupons are trackable and you can assess your marketing efforts with its usage statistics, requiring the user to take one additional step at checkout (entering the correct coupon code) might reduce the 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 alternatives I recommend to apply bulk 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 How to Apply Store-Wide Bulk Discounts in WooCommerce?
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 price and showing the price after the discount on the same line (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. But given that many freelance clients requested this customization, today we’re bringing this back to life with just a few lines of PHP 🙂 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 Drop-down
This is one of those “OMG” moments 🙂
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.
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 need to do custom loops or complex PHP… it’s a “one liner”! Continue reading WooCommerce: Check if Product ID is in the Cart
You’re going to thank me in the comments, I know 🙂
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
Hello my dear WooCommerce friends, today we look at a very simple snippet that achieves a very complex task – what if you wanted to force your CArt just to charge a deposit or a fixed fee, no matter the product price? 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. Who knew it was this easy? Continue reading WooCommerce: Define Add to Cart Min, Max & Incremental Quantities
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. Continue reading WooCommerce: Display All Products in a Table / List
This has been on my to-write list for a looooooong while! You might want to show a “POA” or “Call for Price” when you have a product with no price. Many businesses require this, mostly real estate and wholesalers. So let’s see how it’s done 🙂 Continue reading WooCommerce: POA / Call for Price Button @ Single Product Page
So many times I needed to “play” with Cart contents in order to modify the default behaviour (such as removing a columns, hide the sale price to prices, hide an item, etc.).
There is a great PHP function that always helps – it’s called print_r and you can use this to “see” what’s inside the cart array, so that you can return certain information in a message for example.
A bit advanced, but as you grow your WooCommerce coding skills, you will use this a lot 🙂 Continue reading WooCommerce: See What’s Inside the Cart Array (print_r)