
A sales badge is a small banner displayed on a product page or in a product listing, and it is typically used to highlight a sale or promotion.
By default, WooCommerce includes a basic sales badge that displays the percentage discount for a product, but store owners can also customize the text and appearance of the badge to suit their needs better.
In this tutorial, I’ll show you how to add custom sales badge text in WooCommerce, so that you can effectively promote your sales and drive more conversions.
Benefits of Custom Sales Badge Text
Here are a few benefits of adding custom sales badge text in WooCommerce:
- Attract attention: By customizing the text and appearance of the badge, store owners can make it stand out and effectively communicate the promotion details.
- Increase conversions: By highlighting the savings or benefits of a promotion, a sales badge can help to drive more conversions and increase sales.
- Improve user experience: Custom sales badge text can help improve customers’ experience by providing them with clear and accurate information about promotions and sales.
- Flexibility: By using custom sales badge text, store owners have the flexibility to tailor the language and appearance of the badge to match the tone and branding of their store.
From launching to customizing your WooCommerce stores, Cloudways is at your service.
Whether you’re a beginner or an expert, Cloudways Platform is based on UI, where you can create and customize your online store in a few seconds.
Default Sales Badge Text in WooCommerce
Some WooCommerce store owners don’t like the default sale badge text and want to customize it, e.g., 50% off. By default, it looks like this:
Add Custom Sales Badge in WooCommerce
To customize sales badge text in WooCommerce, you just need to add the following code to the functions.php file of your theme.
add_filter('woocommerce_sale_flash', 'woocommerce_custom_sale_text', 10, 3); function woocommerce_custom_sale_text($text, $post, $_product) { return '<span class="onsale">50% Off</span>'; }
After adding the code, your sales badge text will look like this:
Summary
The sale badge text is the most eye-catching portion of the product viewer. You can also include event names such as Black Friday, Christmas, and others to attract buyers and mention your deals and discount offers. This can help attract customers’ attention, increase conversions, and improve the user experience. Additionally, don’t forget to prepare for BFCM Prepathon. This event will provide you with invaluable insights and strategies to make the most out of the upcoming holiday sales season. Get ready to seize the BFCM opportunity!
Owais Alam
is the WordPress Community Manager at Cloudways - A Managed WooCommerce Hosting Platform and a seasoned PHP developer. He loves to develop all sorts of websites on WordPress and is in love with WooCommerce in particular. You can email him at [email protected]