WooCommerce Show price suffix on shop/listing page

Today we are going to talk about how to add a price suffix on all WordPress or WooCommerce shop or listing page. With the use of the below-written code, you can add custom price suffix on both the category and product pages of your WooCommerce website. The good part is that it will not affect your existing price suffix.

add_filter( 'woocommerce_get_price_suffix', 'qaisarsatti_price_suffix', 999, 4 );
function qaisarsatti_price_suffix( $html, $product, $price, $qty )
{
global $woocommerce_loop;
// Not on single products
  if ( ( is_product() && isset($woocommerce_loop['name']) && ! empty($woocommerce_loop['name']) ) || ! is_product() )
  {
    $html .= ' ' . __('Some Text');
  }
return $html;
}

Another Method to add the suffix.

add_filter( 'woocommerce_get_price_html', 'qaisarsatti_price_suffix', 999, 4 );
function qaisarsatti_price_suffix( $price, $product )
{
global $woocommerce_loop;
// Not on single products
  if ( ( is_product() && isset($woocommerce_loop['name']) && ! empty($woocommerce_loop['name']) ) || ! is_product() )
  {
    $price .= ' ' . __('Suffix');
  }
return $price;
}

Qaisar Satti

Hi, I'm Qaisar Satti! I've been a developer for over 20 years, and now I love sharing what I've learned through tutorials and guides. Whether you're working with Magento, PrestaShop, or WooCommerce, my goal is to make your development journey a bit easier and more fun. When I'm not coding or writing, you can find me exploring new tech trends and hanging out with the amazing developer community. Thanks for stopping by, and happy coding!