To create custom fields that retrieve information from ACF (advanced custom field) you need to use the_field function. An easy template that you can use is this one:
Getting Order ACF
return get_field('your_field_name',$order->get_id());
Replace “your_field_name” for the name/id (not the label) of the field that you want to retrieve, example:
Getting Product ACF
Getting the product field is a little more tricky but can be done with this code
$product=$item->get_product();
if($product==null)
return '';
if($product->is_type('variation'))
$product=wc_get_product($product->get_parent_id());
return get_field('your_field_name',$product->get_id());
5
OCT
2021
OCT
2021
0