I have a custom field, 'woocommerce_product_rate' for a woocommerce product intended to be added after the quantity input field, so instead of just displaying, for example, "10", it can display "10 Bananas". I'm trying to retrieve the product ID within quantity-input.php, but am having difficultly. I tried accessing it through the "$product" global using $product->get_the_id(), but that renders a php error. Trying to access the $post global doesn't work either.
/**
* Product quantity inputs
*/
global $product;
$id = $product->get_id();
$unit = get_field('woocommerce_product_rate', $id);
<?php if( $unit !== '') {echo $unit . " ";} ?>
Any suggestions on how to get around this problem would be greatly appreciated, thank you.