I have created a field group called “pick_up_location” as a mandatory field on the product creation of Woocommerce, and I generated the PHP as per below, but now I am totally lost as to where to put this code. I added it to the functions.php file but it still does not display the field on the Woocommerce product.
if( function_exists(‘acf_add_local_field_group’) ):
acf_add_local_field_group(array(
‘key’ => ‘group_5c07939362208’,
‘title’ => ‘Pick Up Location’,
‘fields’ => array(
array(
‘key’ => ‘field_5c07939fec955’,
‘label’ => ‘Pick Up Location’,
‘name’ => ‘pick_up_location’,
‘type’ => ‘text’,
‘instructions’ => ‘Where will this product be collected from?’,
‘required’ => 1,
‘conditional_logic’ => 0,
‘wrapper’ => array(
‘width’ => ”,
‘class’ => ”,
‘id’ => ”,
),
‘default_value’ => ”,
‘placeholder’ => ”,
‘prepend’ => ”,
‘append’ => ”,
‘maxlength’ => ”,
),
),
‘location’ => array(
array(
array(
‘param’ => ‘post_type’,
‘operator’ => ‘==’,
‘value’ => ‘product’,
),
),
),
‘menu_order’ => 2,
‘position’ => ‘acf_after_title’,
‘style’ => ‘default’,
‘label_placement’ => ‘left’,
‘instruction_placement’ => ‘field’,
‘hide_on_screen’ => ”,
‘active’ => 1,
‘description’ => ‘Location’,
));
endif;