Display an ACF Custom Field and Field Label in WooCommerce Product Page

Display an ACF Custom Field + field label in WooCommerce product page, just copy paste the snippet below to your functions.php and change the name of the custom field (store_stock_number).
With this field I show an extra Store Stock number just before Product meta. To use another hook position, check the available hooks on second code table.

add_action( 'woocommerce_product_meta_start', 'awk_store_stock_number', 3 );
function awk_store_stock_number() { ?>

<?php
$field = get_field_object('store_stock_number');
?>

<?php if($field) { ?>
	<div class="awk-store-stock-number"><?php echo $field['label']; ?>: <?php echo $field['value']; ?></div>
<?php }
}

Below are some standard WooCommerce hook positions. Use numbers to designate the order of the elements.
You can see the WooCommerce Single Product Page Visual Hook Guide here
As you can see in the above code we used the hook: “woocommerce_product_meta_start” to have Store Stock above product Meta.
NOTE: If there is no element published in the specific Hook area, you can not see the ACF!

add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
Scroll to Top