How to Add a Custom Text Before the Product Price Display using Custom Code in WooCommerce WordPress

preview_player
Показать описание
In this woocommerce tutorial for beginners you will learn how to show custom text / prefix before products prices using custom php snippet in shop / archives / categories / single product pages in wordpress website.

* Use below Code to Add Text before Product Price:

add_filter( 'woocommerce_get_price_html', 'cw_change_product_price_display' );
add_filter( 'woocommerce_cart_item_price', 'cw_change_product_price_display' );
function cw_change_product_price_display( $price ) {
// Your additional text in a translatable string
$text = __('TEXT');

// returning the text before the price
return $text . ' ' . $price;
}

* In code you see " TEXT ", so you can add your custom text in code.

#woocommerce #customtext #text #prefix #product #products #wordpress #wordpresstutorial #webtaskwithhassan #hassangilani
join shbcf.ru