WooCommerce display price before add to cart


I’m trying to make the WooCommerce product price display before the “add to cart” button, however, I cant seem to get the price to display.

Here is the code I’m using in my functions.php

add_action( 'woocommerce_before_add_to_cart_button', 'misha_before_add_to_cart_btn' );
function misha_before_add_to_cart_btn(){
    echo '<div class="btn-price">'. $product->get_price_html().'</div>';

Please would someone be able to point out where I’m going wrong with the code that I’m using above.

Jordan Kellet 4 months 0 Answers 16 views 0

Leave an answer