Hide the WooCommerce “on sale” badge in Astra themes

Published by John Jago

Summary

This is a tutorial on how to remove the “sale!” or “on sale” badges from the product image on the shop page and on product pages in WooCommerce when using an Astra theme. It assumes no coding experience and goes through each step with screenshots.


If you’ve seen these sale banners on products in your WooCommerce store, and you want them gone, here’s how you can do it while still keeping the items on sale.

Screenshot of the sale badges on items on the shop page of a WooCommerce store.

For most Astra themes

WordPress is transitioning to an interactive site editor instead of the classic “Customize” menu, but for most older themes and likely many Astra themes, you can add custom code to hide the sale badges using the following steps.

  1. Go to your site’s dashboard (log in to WordPress).
  2. In the side navigation, go to Appearance → Customize → Additional CSS.
  3. Paste the following code:
    .ast-onsale-card {
    	display: none !important;
    }
    
  4. Click the “Save Changes“ button.

After doing this, you should no longer see the sale badge on either the shop page or product page, even if the item is on sale.

For the new WordPress site editor

If the theme supports the new WordPress site editor (released in 2022 and becoming more popular among themes in the following years), the steps are a little different.

  1. Go to your site’s dashboard (log in to WordPress).
  2. In the side navigation, go to Appearance → Editor.
  3. Click on “Styles”.

Screenshot of the WordPress full site editor after landing on it from the WordPress dashboard.

  1. Click the pencil icon to edit styles.

Screenshot of the WordPress full site editor after clicking “Styles”.

  1. At the bottom, open “Additional CSS”.

Screenshot of the WordPress full site editor after clicking the pencil icon to further edit styles.

  1. Paste the custom code into the box:
    .ast-onsale-card {
    	display: none !important;
    }
    

Screenshot of the WordPress full site editor showing the box where to paste the custom code to hide the Astra sale badges.

  1. Click “Save”.

👋 Hey there! We’re the creators of Dashify, a free plugin that transforms the WordPress admin into an ecommerce-focused dashboard, helping you manage your store faster and more effectively.