how to add text in front of price but it should visible only on product page - woocommerce

Viewed 15

what i really want is to add text in front of price in product page. i have tried several method but text is adding in front of all price instead of price visible only on product page.

here what i have tried -

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 = __('MRP');

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

but text 'MRP' is getting added all over the price of website. i just want it to show only on product page in front of price.

thanks

0 Answers
Related