Cart Page

WooCommerce: Exclude Product From Discount Coupons

WooCommerce coupon settings allow you to define allowed products (or product categories). What’s missing, however, is the other way around: how to set up a product so that it can never be discounted? Thankfully, a handy WooCommerce filter comes to the rescue (“woocommerce_coupon_is_valid_for_product“) and we can therefore make all coupons “invalid” when a given product […]

The post WooCommerce: Exclude Product From Discount Coupons appeared first on Business Bloomer.

WooCommerce: Get Total Spent By Customer

Enabling WooCommerce functionalities only if a “user spent more than X” is not unusual. For example, you may want to display banners, special offers, discounted prices, conditional content to customers who have purchased more than a given dollar threshold. While coding a function that could get the total spent by a user ID, I stumbled […]

The post WooCommerce: Get Total Spent By Customer appeared first on Business Bloomer.

WooCommerce: Show Product Stock @ Cart Page

We’ve already seen how to display stock quantity and status on the Shop Page – today we’ll do something similar, but this time we’ll work on the Cart product table, so that we can visually display stock status and quantity to WooCommerce customers who are about to checkout. Please note – in order for the […]

The post WooCommerce: Show Product Stock @ Cart Page appeared first on Business Bloomer.

WooCommerce: How to Alter Cart Items Count

We’ve already seen how to exclude hidden products from the WooCommerce Mini-Cart widget counter; today I want to expand on the same concept and try to recalculate / alter such counter based on custom criteria. For example, some business models require to count the number of distinct items in the Cart, no matter their respective […]

The post WooCommerce: How to Alter Cart Items Count appeared first on Business Bloomer.

WooCommerce: Set / Override Product Price Programmatically

There are times when the edit product page settings are not enough. Yes, you usually set regular and sale price via the price fields under “Product Data”; however sometimes you may have to override those prices via code, because you’re running a special promotion, you don’t want to manually change thousands of prices or maybe […]

The post WooCommerce: Set / Override Product Price Programmatically appeared first on Business Bloomer.

WooCommerce: Get Cart Info (total, items, etc) from $cart Object

As a WooCommerce development freelancer, every day I repeat many coding operations that I keep forgetting over and over again! This means I have to search through the WooCommerce plugin files again and again and waste a lot of precious time. We’ve already seen how to get $product and $order information from their respective objects […]

The post WooCommerce: Get Cart Info (total, items, etc) from $cart Object appeared first on Business Bloomer.

WooCommerce: Sync Product Quantities @ Cart

This snippet will help you synchronize all your cart items’ quantities with a given product ID quantity. When you add a second product to cart, therefore, it will get the same quantity of your product ID. Also, if you update the quantity of product ID, the other cart item quantities will automatically update accordingly. Applications […]

The post WooCommerce: Sync Product Quantities @ Cart appeared first on Business Bloomer.

WooCommerce: Set Min Purchase Amount for Specific Product

We already studied how to set min/max WooCommerce add to cart quantity programmatically. That was an easy one. This time, I want to expand on the topic, and define a “minimum order amount on a per-product basis”. Which, translated in plain English, would be something along the lines of “set the minimum purchase amount for […]

The post WooCommerce: Set Min Purchase Amount for Specific Product appeared first on Business Bloomer.

WooCommerce: “Split” Cart Table (A>Z Headings)

Because “split” might not be the correct term, let me explain this better. Let’s imagine your WooCommerce cart table is sorted by A>Z (with my WooCommerce cart sorting snippet for example). If your business model and/or UX requires it, then you might need to “add a cart table row” to communicate the fact those items […]

The post WooCommerce: “Split” Cart Table (A>Z Headings) appeared first on Business Bloomer.

WooCommerce: Show Checkout Even If Cart Is Empty

By default, the WooCommerce Checkout page redirects you back to the (empty) Cart page in case there are no products in the Cart. Now, there are times when you still need users to see the Checkout page and avoid this redirect. And thankfully, WooCommerce provides us with two filters that we can use to immediately […]

The post WooCommerce: Show Checkout Even If Cart Is Empty appeared first on Business Bloomer.

WooCommerce: Remove Product From Cart Programmatically

We already saw how to add a product to cart automatically, for example if you visit a specific page or if there are no products in the cart – but today we want to find out how to do the opposite: if a certain condition is met, we want to remove a product ID from […]

The post WooCommerce: Remove Product From Cart Programmatically appeared first on Business Bloomer.

WooCommerce: Bulk Dynamic Pricing Without a Plugin

You’re looking to assign different unit prices based on the quantity added to Cart, for example from 1-100 price is $5, from 101-1000 price is $4.90 and from 1001 units ordered price becomes $4.75. There are many “Dynamic Pricing” plugins out there (and the number #2 on this article would suit complex pricing rules and […]

The post WooCommerce: Bulk Dynamic Pricing Without a Plugin appeared first on Business Bloomer.

WooCommerce: Edit “Continue Shopping” Link Redirect

“Continue Shopping” appears on the Cart page when an item is added to Cart and you have “Redirect to the cart page after successful addition” enabled via the WooCommerce settings. By default, “Continue Shopping” button redirects to the previously visited page – sometimes this makes no sense and you might want to send them back […]

The post WooCommerce: Edit “Continue Shopping” Link Redirect appeared first on Business Bloomer.

WooCommerce: 10 Easy Snippets to Increase Your Sales

I had the pleasure to speak at WordCamp Prague 2019. I spoke about “10 PHP Snippets to Increase WooCommerce Sales” and managed to show some simple coding to the audience. Trust me – increasing your WooCommerce sales can also be done with a free, short, easy PHP snippet. So, given that I want to share […]

The post WooCommerce: 10 Easy Snippets to Increase Your Sales appeared first on Business Bloomer.

WooCommerce: Move / Remove Coupon Form @ Cart & Checkout

Coupons: the good, the bad and the ugly. WooCommerce coupon codes are great to convert more sales – but sometimes they get users to pause / stop placing the order until they find a coupon code online (you did it too, I know). One good workaround that the internet giants such as Amazon and eBay […]

The post WooCommerce: Move / Remove Coupon Form @ Cart & Checkout appeared first on Business Bloomer.

WooCommerce: Remove Product Links @ Cart Page

We’ve already seen how to remove the product permalink from the “order table” (the one you see on the Thank you page, My account pages and emails). Thsi time, we’re looking at doing the same thing on the Cart page, which uses different “hooks” than the order pages and therefore requires its own snippet. Here’s […]

The post WooCommerce: Remove Product Links @ Cart Page appeared first on Business Bloomer.

WooCommerce: Put Cart & Checkout on the Same Page

This is your ultimate guide – complete with shortcodes, snippets and workarounds – to completely skip the Cart page and have both cart table and checkout form on the same page. But first… why’d you want to do this? Well, if you sell high ticket products (i.e. on average, you sell approximately one product per […]

The post WooCommerce: Put Cart & Checkout on the Same Page appeared first on Business Bloomer.

WooCommerce: Exclude Hidden Products from Mini-Cart Counter

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 […]

The post WooCommerce: Exclude Hidden Products from Mini-Cart Counter appeared first on Business Bloomer.

WooCommerce: Hide Checkout Billing Fields if Virtual Product @ Cart

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 […]

The post WooCommerce: Hide Checkout Billing Fields if Virtual Product @ Cart appeared first on Business Bloomer.

WooCommerce: Hide Mini-Cart Widget (Dropdown)

Less is more (sometimes). On this website, I’m already forcing max 1 product in the Cart and automatically redirecting users to Checkout upon add to Cart. As a result, I definitely didn’t need the whole “Mini-Cart Widget Dropdown Content” either. To test, try to “hover” onto the shopping cart icon on the top right, and […]

The post WooCommerce: Hide Mini-Cart Widget (Dropdown) appeared first on Business Bloomer.

WooCommerce: Add Product to Cart When Visiting a Specific Page

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 […]

The post WooCommerce: Add Product to Cart When Visiting a Specific Page appeared first on Business Bloomer.

WooCommerce: How to Hide “Shipping Calculator” Fields @ Cart

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 […]

The post WooCommerce: How to Hide “Shipping Calculator” Fields @ Cart appeared first on Business Bloomer.

WooCommerce: Rename “Add to Cart” Button if Product Already @ 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 […]

The post WooCommerce: Rename “Add to Cart” Button if Product Already @ Cart appeared first on Business Bloomer.

WooCommerce: Sort Cart Items Alphabetically A>Z

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 […]

The post WooCommerce: Sort Cart Items Alphabetically A>Z appeared first on Business Bloomer.

WooCommerce: Automatically Update Cart on Quantity Change

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 […]

The post WooCommerce: Automatically Update Cart on Quantity Change appeared first on Business Bloomer.

WooCommerce: How to Edit Product Prices in Bulk?

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 […]

The post WooCommerce: How to Edit Product Prices in Bulk? appeared first on Business Bloomer.

WooCommerce: Check if Product Category is in the Cart

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 […]

The post WooCommerce: Check if Product Category is in the Cart appeared first on Business Bloomer.

WooCommerce: Display Cart Item Subtotal With Coupon Discount

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. […]

The post WooCommerce: Display Cart Item Subtotal With Coupon Discount appeared first on Business Bloomer.

WooCommerce: Slashed Cart Subtotal if Coupon @ Cart

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 🙂 PHP Snippet: show slashed original and discounted subtotal @ WooCommerce Cart

The post WooCommerce: Slashed Cart Subtotal if Coupon @ Cart appeared first on Business Bloomer.