Scriptfeeds Blog
  • Blog
  • WordPress
    • Woocommerce
    • WordPress Errors
    • WordPress Plugins
  • Development
    • WordPress Themes
  • Hire us
Plugin Install : Cart Detail need WooCommerce plugin to be installed.
No Result
View All Result
Scriptfeeds Blog
  • Blog
  • WordPress
    • Woocommerce
    • WordPress Errors
    • WordPress Plugins
  • Development
    • WordPress Themes
  • Hire us
Plugin Install : Cart Detail need WooCommerce plugin to be installed.
No Result
View All Result
Scriptfeeds Blog
No Result
View All Result
Home Wordpress

How to add Text after price in WooCommerce products

Scriptfeeds by Scriptfeeds
April 15, 2025
in Wordpress
0

Sometimes , you may have to add few text after price in WooCommerce products. This text can be anything like (Tax inclusive) or may be (Fees and Tax inclusive) . These text after prices can help customer to understand the price break of your product.

Here’s how you can show a line like “(Fees & Tax included)” or any other text right after the price in WooCommerce Products

Table of Contents

  • If you want to add for Specific Product:
    • What it does:
  • If you want to add for Multiple Products:
  • Code for Specific Text Per Product:
    • How to use?

If you want to add for Specific Product:

Add this to your theme’s function.php

add_filter('woocommerce_get_price_html', 'scriptfeeds_add_tax_info_to_price', 20, 2);
function scriptfeeds_add_tax_info_to_price($price, $product) {
    // Replace 1428 with your specific product ID
    if ($product->get_id() == 1428) {
        $price .= ' <span style="font-size:14px; color:#666;">(Fees & Tax included)</span>';
    }
    return $price;
}

What it does:

  • Only applies to product ID 1428 (change to your desired product).
  • Appends a clean line after the price.
  • Customizable styling with font size and color.
Quick ways to add Text after price in WooCommerce products

If you want to add for Multiple Products:

Add below code in function.php file of your child theme

add_filter('woocommerce_get_price_html', 'scriptfeeds_add_tax_info_to_price', 20, 2);
function scriptfeeds_add_tax_info_to_price($price, $product) {
    // Add all product IDs you want to target
    $target_product_ids = [1428, 1430, 1442]; // replace with your product ID's or Add more IDs as needed

    if (in_array($product->get_id(), $target_product_ids)) {
        $price .= ' <span style="font-size:14px; color:#666;">(Fees & Tax included)</span>';
    }
    return $price;
}

You can add as many product ID’s you want. Don’t forget to replace your product ID’s in above code

There can be a situation where you wanna show different text after price for different products. In that case you can use below code.

Code for Specific Text Per Product:

add_filter('woocommerce_get_price_html', 'scriptfeeds_add_custom_text_to_price', 20, 2);
function scriptfeeds_add_custom_text_to_price($price, $product) {
    // Set custom text for specific product IDs
    $custom_texts = [
        1428 => '(Fees & Tax included)',
        1430 => '(Includes free vaccination)',
        1442 => '(Early bird offer applied)',
    ];

    $product_id = $product->get_id();

    if (array_key_exists($product_id, $custom_texts)) {
        $price .= ' <span style="font-size:14px; color:#666;">' . esc_html($custom_texts[$product_id]) . '</span>';
    }

    return $price;
}

You can add as many product ID’s you want. Don’t forget to replace your product ID’s in above code

How to use?

  • Just replace or add to the $custom_texts array with your own product IDs and messages.
  • Styling can also be adjusted per message if needed.

So that’s all you have to do for adding “Text after price” in WooCommerce Products. For any other customization features, you can connect with our developers.

Happy coding

Connect with Developer
Loading

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

I agree to the Terms & Conditions and Privacy Policy.

Scriptfeeds Blog

© 2022 Scriptfeeds

Blog Categories

  • WordPress
  • Development
  • Reviews
  • Marketing

Connect us on

No Result
View All Result
  • Blog
  • WordPress
    • Woocommerce
    • WordPress Errors
    • WordPress Plugins
  • Development
    • WordPress Themes
  • Hire us

© 2022 Scriptfeeds

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.