I don't know much about PHP yet, but I'm trying to place some content in my single product pages by using the woocommerce_before_add_to_cart_form hook.
I succeeded in making a code that prints my text and the Total sales of my products. The code looks like this:
add_action( 'woocommerce_before_add_to_cart_form', 'production_time', 11 );
function production_time() {
global $product;
$production_time = $product->get_total_sales();
if ( $production_time ) echo '<p class="ri ri-clock">' . sprintf( __( ' Productietijd: %s', 'woocommerce' ), $production_time ) . '</p>';
}
But instead of product total sales I want my product custom field value to be displayed.
This is the custom field I added fullfilment_production_time custom field:

I tried changing the get_total_sales() to get_fullfilment_production_time() but that didn't work.
I also tried this one:
add_action( 'woocommerce_before_add_to_cart_form', 'production_time', 11 );
function production_time() {
global $product;
$production_time = $product->get_post_meta( get_the_ID(), 'fullfilment_production_time', true );
if ( $production_time ) echo '<p class="ri ri-clock">' . sprintf( __( ' Productietijd: %s', 'woocommerce' ), $production_time ) . '</p>';
}
Any advice?