I’m trying to add an ACF product field as a price suffix in the cart. (so it would for example show $11.00 / metre)
I think it needs to know the product ID?
I have used $product_id with get_field as seen in another post but it still does not work for me. What am I missing?
add_filter( 'woocommerce_cart_item_price', 'ts_price_unit' );
function ts_price_unit( $price) {
$unit_type = get_field('unit', $product_id); // ACF price per unit field eg. metre
$afterPriceSymbol = '/';
return $price . $afterPriceSymbol . $unit_type ;
}