Add text after price

Sometimes is usefull to add additional text under the product price. With this hook you can easily show additional text just under the price. You can use ScriptOrganiser, CodeSnippets or any other similar plugin.

add_filter( 'woocommerce_get_price_html', 'webbox_change_product_price_display' );
function webbox_change_product_price_display( $price ) {
    return $price . '<div>TEXT AFTER PRICE</div>';
}

This hook could be extended to show message only on specific products. In this case you will need to add ID’s of product into array.

add_filter( 'woocommerce_get_price_html', 'webbox_change_product_price_display' );
function webbox_change_product_price_display( $price ) {
    global $post; $product_id = $post->ID;
    $product_array = array( 1,2,3 ); // ids of products
    if ( in_array( $product_id, $product_array )) {
        $price .= '<div>TEXT AFTER PRICE</div>';
    }
    return $price;
}
text-after-price

// newsletter

Three tested WordPress snippets a week

Blocks, security, performance, Tailwind, PHP and React. Copy, paste, ship. You’ll also get DPlugins product updates. No spam, and you can unsubscribe anytime.

// newsletter

Three tested WordPress snippets a week

Blocks, security, performance, Tailwind, PHP and React. Copy, paste, ship. You'll also get DPlugins product updates. No spam, and you can unsubscribe anytime.

Click to Copy