Product Badges in WooCommerce can be a great way to add some extra style to your products and product pages. They can also be used to communicate special messages or information about your products to your customers.
For example, you might use a badge to indicate that a product is on sale, or that it is a new product.
There are two ways to add badges to products in WooCommerce:
Method 1: Use the WooCommerce Product Badges plugin.
The WooCommerce Product Badges plugin is a free plugin that allows you to easily add badges to your products. Simply install and activate the plugin, then go to Products → Badges in your WordPress admin area to create your first badge. You can then add this badge to any product by going to the Edit Product page and selecting the badge from the Product Badges dropdown menu.
Method 2: Add badges manually using HTML and CSS.
If you don’t want to use a plugin, or if you want more control over how your badges look, you can add them manually using HTML and CSS. First, create a badge image that you want to use. Make sure the image is saved as a .png file with a transparent background.
Then, upload the image to your WordPress site and copy the URL of the image. Next, go to the Edit Product page for the product where you want to add the badge.
In the Description field, add the following HTML code:
<div class="badge-container">
<img src="BADGE URL" alt="BADGE TEXT">
</div>
Replace “BADGE URL” with the URL of the badge image that you just uploaded, and replace “BADGE TEXT” with the desired text for the badge.
You can also add CSS code to style your badges. For example, the following CSS code would center the badge on the product image and make it smaller:
.badge-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 50px;
height: 50px;
}
.badge-container img {
width: 100%;
height: auto;
}
The WooCommerce Product Badges plugin is a free plugin that allows you to easily add badges to your products. Simply install and activate the plugin, then go to Products → Badges in your WordPress admin area to create your first badge.