'Display the WooCommerce product price inside a custom function

I have created a custom function to display 3 custom fields (ACF) and the product price in the WooCommerce Archive/Shop page.

My Custom fields are showing correctly, but the WooCommerce price does not. How can I output the product price within this function?

    add_action( 'woocommerce_after_shop_loop_item', 'acf_template_loop_product_meta', 20 );
function acf_template_loop_product_meta() {
    global $product;

    if ( $brand  = get_field('brand', $product->get_id()) ) {
        echo '<p><strong>'. __("&nbsp;&nbsp;&nbsp;&nbsp") . '</strong> ' . $brand . '</p>';
    }

    if ( $designer  = get_field('designer', $product->get_id()) ) {
        echo '<p><strong>'. __("&nbsp;&nbsp;&nbsp;&nbsp") . '</strong> ' . $designer . '</p>';
    }

    if ( $model  = get_field('model', $product->get_id()) ) {
        echo '<p><strong>'. __("&nbsp;&nbsp;&nbsp;&nbsp") . '</strong> ' . $model . '</p>';
    }
    
    if ( $price = $product->get_price(); ) {
        echo '<p><strong>'. __("&nbsp;&nbsp;&nbsp;&nbsp") . '</strong> ' . $price . '</p>';
    }
}


Solution 1:[1]

Here is the solution if anyone is interested:

   add_action( 'woocommerce_after_shop_loop_item', 'acf_template_loop_product_meta', 20 );
function acf_template_loop_product_meta() {
    global $product;

    if ( $brand  = get_field('brand', $product->get_id()) ) {
        echo '<p><strong>'. __("&nbsp;&nbsp;&nbsp;&nbsp") . '</strong> ' . $brand . '</p>';
    }

    if ( $designer  = get_field('designer', $product->get_id()) ) {
        echo '<p><strong>'. __("&nbsp;&nbsp;&nbsp;&nbsp") . '</strong> ' . $designer . '</p>';
    }

    if ( $model  = get_field('model', $product->get_id()) ) {
        echo '<p><strong>'. __("&nbsp;&nbsp;&nbsp;&nbsp") . '</strong> ' . $model . '</p>';
    }
    
    if ( $price = $product->get_price() ) {
        echo '<p><strong>'. __("&nbsp;&nbsp;&nbsp;&nbsp") . '</strong> ' . ? $price . '</p>';
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 P.Sav