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 default value to your Add to Cart quantity input field on the single product and cart pages. Who knew it was this easy?
Continue reading WooCommerce: Edit Add to Cart Default, Min, Max & Step Product Quantity
Here’s another little WooCommerce tweak for your website user experience: let’s add a string just in front of the Add to Cart button that says “Quantity: “. As usual, the biggest thing is looking for the right “hook”… but thankfully WooCommerce plugin is full of them and adding a string where we want is so easy 🙂 Continue reading WooCommerce: Add “Quantity” Label in front of Add to Cart Button
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)
While working on a workaround for a client, I had to hide a hidden product from the cart, checkout, order received and emails. Hidden products already don’t show on the shop and category pages, but they do show on the cart if they’re added to cart “programmatically”.
A tough task, but as usual here I come with the solution 🙂
Continue reading WooCommerce: Hide Hidden Products From Cart, Order, Emails
Following up from the other day’s snippet (deny checkout based on cart weight), you might want to show what is the current Total Weight on the cart and checkout page in case this is useful to your customers.
Of course, in order for this snippet to work, all your products must have a weight, otherwise the total will always be equal to 0. So here you go – enjoy!
Continue reading WooCommerce: Display Total Weight @ Cart & Checkout
A WooCommerce fan asked me: “How do you deny checkout if the cart weight is above a certain threshold?“.
Well, this is straight forward thanks to a WooCommerce core function called “cart_contents_weight” which allows you to get the total weight of your cart, and then the “wc_add_notice” function which shows a notification error.
Continue reading WooCommerce: Deny Checkout Based on Cart Weight
Here’s how you force redirection to the checkout page every time a product is added to cart, no matter if you do so from the loop/shop pages or the single product page.
On top of adding the code to your functions.php you also need to double check your WooCommerce settings, see screenshot below. Enjoy!
Continue reading WooCommerce: Redirect to Checkout on Add to Cart
A Business Bloomer fan asked me a great question: “I’m using your visual hook guide to add content above the cart, however I notice that it doesn’t work if the cart is empty. Are there hooks specifically for empty carts?“.
Well, let’s take a look if we have anything available… (hint: of course we do!).
Continue reading WooCommerce: Add Content to Empty Cart Page
I have a very long to-write list. Possibly I have enough content for another 2 years 🙂
However, the other day a premium WooCommerce student asked me for some feedback on his custom CSS – so I had to give it priority! The request was: what’s the easiest way to change the little icon/button on the Cart page that has the function of removing items from the cart (yes, that ugly white cross on a red circle)? Continue reading WooCommerce: Change the “Remove this Item” Icon @ Cart
A fan requested an interesting edit on the Shop/Category page (or “loop”). Instead of having the default “Add to Cart” button, they wanted to remove that and substitute with a “View Product” button link to the single product page. Here’s the simple snippet – enjoy!
Continue reading WooCommerce: Remove Add Cart, Add View Product @ Shop Page
In my opinion, the WooCommerce Cart table is somewhat confusing. Why isn’t the “sale price” displayed there? Well, this is a mystery!
I’m pretty confident that showing the “slashed” price would actually help your conversion rate.
So, what about 10 PHP lines in exchange for an increase in sales? Great! Here’s the snippet 🙂
Continue reading WooCommerce: Display Regular & Sale Price @ Cart Table
This week’s snippet is about the Cart Page (perfect timing, as in a few days I will run a free class on “How to Customize the WooCommerce Cart Page“).
Today we’ll focus on the “You may be interested In…” section, also called the “Cross-Sells” area. If a product that is in the cart has cross-sells (Edit Product > Product Data > Linked Products), this section will appear by default. Problem is – it is pretty ugly where it is now and distracts the user from identifying the “Proceed to Checkout” button, the most important CTA (Call To Action) of the Cart page.
So, how can me move it UNDER the Cart Totals, and make the design a little cleaner? Continue reading WooCommerce: Move & Change Number of Cross-Sells @ Cart Page
If you love Ecommerce as much as I do, and are passionate about Sales Conversion Rate and reducing Shopping Cart Abandonment, today’s snippet will come in handy.
Besides, this is officially the first guest blog on Business Bloomer (have ideas? Send me your proposal here)… so let me officially introduce you to today’s author: Jamie Gill, a WordPress & WooCommerce enthusiast from Bradford, UK.
Jamie managed to code a handy snippet to display inside Cart and Checkout totals the total amount of money a customer saved (sale prices plus coupon discounts). Over the years this snippet went through several revisions, but it’s still working smoothly – enjoy!
Continue reading WooCommerce: Display Total Discount / Savings @ Cart & Checkout
Here’s how to create custom WooCommerce Add to Cart HTML links / buttons and make them add a given quantity of a single product to cart and redirect to specific website pages.
This tutorial explains how to achieve that for simple products but also variable and grouped types.
I strongly recommend to read through all the post comments in case you’re not sure about something – many people have asked the same questions over and over again e.g. “is it possible to add more than 1 product to Cart?” (to which the answer is “no”, unless you create a Grouped Product).
With this guide it’s much easier to place Add to Cart buttons on custom landing pages, pricing tables, blog posts and so on. Enjoy!
Continue reading WooCommerce Custom “Add to Cart” URLs – The Ultimate Guide
Today we take a look at the WooCommerce “Add to Cart” buttons. What if you wanted to change the “Add to Cart” text depending on the Product Category? For example, you may want to show “Buy Now” for books and “Add to Basket” for cds.
Continue reading WooCommerce: Edit “Add to Cart” Text by Product Category
Today we take a look at the WooCommerce Checkout and specifically at how to disable a payment gateway (e.g. PayPal) if a specific product category is in the Cart.
There are two tasks to code in this case: (1) based on all the products in the Cart, calculate the list of product categories in the Cart and (2) disable a specific payment ID if the target product category is in the Cart.
May sound difficult but don’t worry – solution is right below. Enjoy!
Continue reading WooCommerce: Disable Payment Method If Product Category @ Cart
A client wanted to completely remove the area on the Cart page where “You may be interested in…” cross-sell products show.
This is helpful if business needs change at some time and you don’t want to manually remove cross-sells from each single product in your store by hand. Enjoy!
Continue reading WooCommerce: Remove Cross-Sells @ Cart Page
Quite an interesting functionality! A WooCommerce client wanted their Cart pre-filled with one product as soon as their customers accessed the website. I don’t remember the exact reason, but this could be useful when you want to give them a free product by default, or you want to send your visitors straight to checkout with a product already in the cart without letting them add anything first.
Adding an item to cart programmatically is the same as “automatically”. Basically, all users will have a default, non-empty Cart filled with an item of your choice. So, let’s see how this snippet works!
Continue reading WooCommerce: Add Product to Cart On Visit Programmatically