• Resolved gmul

    (@gmul)


    Hello,
    I wanted to add some text with a link just after the price on the single product pages. I know I can do this with

    add_filter( 'woocommerce_get_price_html', 'custom_price_message' );
    function custom_price_message( $price ) {
      $new_price = $price . ' <span class="my-suffix">' . __('incl. <a href="...">VAT</a>').'</span>';
      return $new_price;
    }

    but this adds the suffix on the product archives as well – I only need it on the single product pages. Does anyone by chance know how to change this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • add_filter( 'woocommerce_get_price_html', 'custom_price_message' );
    function custom_price_message( $price ) {
    	if( is_product() ) {
      		$price = $price . ' <span class="my-suffix">incl. <a href="...">VAT</a></span>';
    	}
     return $price;
    }

    Try that ^

    Kadence Themes

    Thread Starter gmul

    (@gmul)

    Thank you, I got it!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Question price suffix’ is closed to new replies.