Troubleshooting WooCommerce Sale Price Caching Issue on Single Product Pages

In a recent Business Bloomer Club discussion, a WooCommerce developer raised an issue where a client’s expired sale prices were still visible to logged-out users on single product pages.

This unusual behavior didn’t affect cart prices but created confusion on the product page.

Although server-side caching appears to be the main culprit, many WooCommerce users are unfamiliar with managing caching strategies for dynamic content like sales pricing.

WooCommerce product pages often display time-sensitive information, such as sale prices, which updates dynamically. Most cache plugins designed for WooCommerce will bypass product pages to avoid issues. However, server-side caching may not automatically account for this dynamic content, leading to expired sale prices being “stuck” in the cache and visible to users until the cache is purged.

Continue reading Troubleshooting WooCommerce Sale Price Caching Issue on Single Product Pages

Handling Decimal Rounding Issues in WooCommerce: Customer Perspective

In a recent Business Bloomer Club discussion, a question arose regarding WooCommerce’s handling of decimal rounding, especially when discounts introduce fractional amounts.

A common scenario involves applying a percentage discount to a product price, leading to numbers that extend beyond WooCommerce’s typical two-decimal rounding.

While WooCommerce correctly calculates subtotals using the full decimal value, this can sometimes result in minor inconsistencies between displayed price and subtotal that may appear confusing to customers. Let’s explore how to address this and ensure a smooth user experience.

Continue reading Handling Decimal Rounding Issues in WooCommerce: Customer Perspective

WooCommerce: Filter Products By Sale Status @ WP Dashboard

Managing a WooCommerce store means keeping a close eye on your product pricing, especially when running promotions or sales. However, sorting through hundreds or even thousands of products to find those with active sale prices can be a tedious task using the default WordPress admin interface.

Imagine being able to quickly filter your product list to display only items that are currently on sale, allowing you to streamline your updates and promotional strategies…

In this post, I’ll show you how to enhance your WooCommerce admin panel with a simple PHP snippet that adds a custom filter for sale status.

This solution not only saves you time but also simplifies inventory management, making it easier to plan marketing campaigns and update product details efficiently. Let’s dive into the code and get started!

Continue reading WooCommerce: Filter Products By Sale Status @ WP Dashboard

WooCommerce: Display Only Products On Sale @ Shop

In my own WooCommerce shop, for Black Friday, I wanted to send customers directly to the Shop page showcasing only items on sale. To my surprise, WooCommerce doesn’t provide a built-in way to sort products by “on sale” out of the box.

This led me to explore a solution that not only solved the problem but also added a new sorting option to the WooCommerce Shop page dropdown.

Now, with a simple code snippet, you can enable a “Sort by On Sale” feature, or even use the “orderby=on_sale” parameter with your Shop page URL to show sale items effortlessly!

Continue reading WooCommerce: Display Only Products On Sale @ Shop

WooCommerce: “Last Chance” Category with Expiring Sale Products

When managing a WooCommerce store, your sales strategy can be a powerful way to engage customers and drive urgency.

One cool trick is featuring products with sale prices about to expire (“sale price end date“) in a custom product category. We’ve already seen how to populate a “Sale” category, but this time I’d like to get only the sale products with a sale end date!

Highlighting expiring sale items allows store owners to showcase time-sensitive deals, enticing shoppers to act fast before discounts disappear. This approach not only enhances the shopping experience but can also boost conversions during critical sales periods.

In this tutorial, we’ll explore how to dynamically populate a custom WooCommerce category with products whose sale end dates are approaching. Using a PHP code snippet, you’ll learn how to identify expiring sale items and assign them to a dedicated category automatically.

Whether you’re a store owner looking to create a “Last Chance” section or a developer helping clients achieve similar functionality, this guide will walk you through the steps. Let’s dive in!

Continue reading WooCommerce: “Last Chance” Category with Expiring Sale Products

WooCommerce: Sale End Date Countdown Timer

Are you tired of the same old “Sale!” badge on your WooCommerce products? Want to create a more engaging and dynamic shopping experience for your customers?

In this blog post, we’ll guide you through a simple PHP/JS customization that replaces the static “Sale!” badge on the WooCommerce Single Product page with a captivating countdown timer. This will not only add excitement to your product page but also encourage customers to make a purchase before the sale ends.

Get ready to elevate your WooCommerce store and boost your sales with this effective customization. Enjoy!

Continue reading WooCommerce: Sale End Date Countdown Timer

WooCommerce: Get Products On Sale Via PHP

We’ve already seen how to programmatically assign the “Sale” category to WooCommerce products on sale. That snippet actually uses the “shortcut” function we’re talking about today, wc_get_product_ids_on_sale().

This is a super helpful way to get something without complex queries or foreach loops. So I’d like to study its codebase, see what it returns, and finally test it and print something via a shortcode.

Enjoy!

Continue reading WooCommerce: Get Products On Sale Via PHP

WooCommerce: Hide Sale! Badge If Product Is Out Of Stock

If a product cannot be purchased because it is out of stock, why would you want to tell people that it’s on sale – only because it has a sale price?

That would probably clutter your shop and maybe get the customer to click on the wrong item just because it was standing out, only to find out they can’t purchase it!

So, let’s fix this little “design bug” in WooCommerce – let’s make sure the Sale! badge gets hidden in case the product is out of stock. Enjoy!

Continue reading WooCommerce: Hide Sale! Badge If Product Is Out Of Stock

WooCommerce: Preparing Your Site for Black Friday / Cyber Monday

Black Friday and Cyber Monday (BFCM) are just around the corner. Is your WooCommerce site prepared? I hope so!

While time is running out, there are a number of things you can do to get ready. In this post, we’ll cover eight of the most important ones.

The potential of a Black Friday / Cyber Monday deal shouldn’t be underestimated. Indeed, many eCommerce sites report that a significant percentage of their annual revenue comes from sales during this brief period of time. 

Additionally, it’s important to remember that nearly all businesses run a BFCM sale, which means that anyone who doesn’t have an offer is missing out.

Before we jump into the eight important things you can do, a final note: failing to prepare may cost you a serious amount of missed revenue. Amazon, for example, stands to lose $13.22 million per hour of downtime! While that’s an extreme example, it is a reminder that downtime should be avoided as much as possible during once-a-year sales events.

Continue reading WooCommerce: Preparing Your Site for Black Friday / Cyber Monday

WooCommerce: Apply Discount to Cheapest Cart Item

If you run WooCommerce store promotions, this little snippet will help you with that. For example, how to run a “Buy 2 products, get one half off” or a “Buy 3 products, get the cheapest one for free” campaign?

The trick behind this workaround is to find the cheapest item by looping through the cart, and then to set its price so that it’s lower than the regular price. Enjoy!

Continue reading WooCommerce: Apply Discount to Cheapest Cart Item

WooCommerce: Set Product Price Based On Other Products!

I’m Italian and I love exclamation marks! I also love WooCommerce customization, as you may know. This time I want to show you how I programmatically define the price of my WooCommerce Mini-Plugin All-Access-Bundle product… based on other products.

The backstory: as of today, I sell 18 WooCommerce plugins, and soon I should reach the 400 mark if all goes well. So, I came up with the idea of creating a bundle, and let customers gain access to all of them within a single, discounted purchase.

Yes, I could have purchased a Product Bundle plugin… but I wanted to see if I could create a bundle out of a Simple product.

The only requirements were: set the regular price based on the total price of the plugins, set its sale price based on a percentage discount, automate this so I don’t need to manually update the bundle price every time I add a new product, and add all plugin products to the order upon bundle purchase (we will see this in another snippet). Enjoy!

Continue reading WooCommerce: Set Product Price Based On Other Products!

WooCommerce: Display Sale Price End Date @ Shop & Single Product Page

WooCommerce allows you to “schedule” the product sale price – you can define a start date and an end date, so that you can run your promotion automatically.

However, for some reason, this information is only visible to the admin. It would be awesome to show the “sale price end date” to customers as well, don’t you think? So, let’s do it!

Continue reading WooCommerce: Display Sale Price End Date @ Shop & Single Product Page

WooCommerce: Move Sale Badge Beside Price @ Single Product Page

On a default theme, such as Storefront, the single product page template is laid out so that the SALE badge comes first, on its own line, then comes the product title, the product price on its own line, the short description, the product’s stock availability and the add to cart button.

As you can see from the screenshot below, there is lots of white space on the right hand side, so for my new business line (WooCommerce Mini-Plugins, you somewhat guessed it, right?) I wanted to improve the single product page layout and move the SALE badge right beside the price, so that I could achieve two objectives: save some space, and also focus the customer attention on the product price as opposed on to the badge.

So, let’s see how I did it. Enjoy!

Continue reading WooCommerce: Move Sale Badge Beside Price @ Single Product Page

WooCommerce: Set Product Discount Percentage @ Product Admin

Let’s say you want to apply a 10% discount on a WooCommerce product. Its original price is $79.56. You go to the “Edit Product” page, go to the “Sale Price” input field, and enter ( $79.56 – 10% ) = $71.63. This is great as you can set the sale price, but this forces you to do some math and waste time.

What if there were a custom select dropdown, where you could directly define a fixed discount e.g. 10% or 25%, without having to calculate the final price?

Well, in today’s tutorial, we’ll see how we can display a dropdown in the Product Edit page, and at the same time how to edit the frontend price once a discount value is selected, so that you don’t need to worry about that manual sale price calculation. Enjoy!

Continue reading WooCommerce: Set Product Discount Percentage @ Product Admin

WooCommerce: “Sale” Category (Automatic)

You can use a shortcode or block in order to display the WooCommerce products on sale. However, what if you wanted a proper “product category” called “Sale” – and where you didn’t need to manually assign this category to each product?

Basically, how do we display all the discounted products in a custom category called “Sale”, without doing any manual work?

Here’s a super quick tutorial. Enjoy!

Continue reading WooCommerce: “Sale” Category (Automatic)