Hi there ??
Upon checking on the internet, I could find a code snippet that could do the job for you. I’ve modified it a little bit, in order to meet your needs.
Here is the code:
add_filter( 'woocommerce_product_add_to_cart_text', 'custom_add_to_cart_price', 20, 2 ); // Shop and other archives pages
add_filter( 'woocommerce_product_single_add_to_cart_text', 'custom_add_to_cart_price', 20, 2 ); // Single product pages
function custom_add_to_cart_price( $button_text, $product ) {
// Variable products
if( $product->is_type('variable') ) {
// shop and archives
if( ! is_product() ){
$product_price = wc_price( wc_get_price_to_display( $product, array( 'price' => $product->get_variation_price() ) ) );
return $button_text . ' - From ' . strip_tags( $product_price );
}
// Single product pages
else {
return $button_text;
}
}
// All other product types
else {
$product_price = wc_price( wc_get_price_to_display( $product ) );
return 'BUY THIS ITEM FOR ' . strip_tags( $product_price );
}
}
I normally recommend using the Code Snippet plugin in order to add custom PHP code into your site without having to touch the functions.php
file. Here is a link on how to use the Code Snippet plugin:
https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/
Also, here is the link where I found the code:
https://stackoverflow.com/questions/51522141/display-price-on-add-to-cart-button-from-the-functions-php-file-in-woocommerce
I hope that helps!