ACF Integration

Posted by:

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());


0

Intregrating with Extra Product Options Builder

Posted by:

To integrate the plugin with Extra Product Options Builder do the following.

1.- Go to the custom field

2.- Click in “Custom Field Wizard”

3.- Type an order that has the fields that you want to extract

4.- Click in the “Extra Product Options” item

5.- Select the fields that you want to extract

That’s it, following these instructions you can create a custom field that extract any field.

For a more complex integration you can also use the Extra Product Options Api to create your custom field

0

Conditional invoicing with the plugin “Extra Product Options”

Posted by:

To create a conditional invoice using extra product options go to the template builder and follow these steps:

1.- Click on Template Settings/Conditions

2.- Select the field “Extra product options” (to see this field you need to have the extra product options plugin installed and active first).

A new text box will be added below.

3.- In the field “element id” add the “Extra Product Option” id that you want to use, you can find this id in the “Extra product options” designer.

4.- Finish the condition, so for example if i want to create the invoice only when your field (with id 5cfe8c084d6d43.02124573) has the value of “Blue” your condition should look like this:

 

That’s it! If you have any question let me know!

0