Using WC Fields Factory now you have the ability to add custom fields to product’s admin, product admin category and product tabs. Using WC Fields Factory’s Admin Fields option you can add Text Box, Text Area, Number, Email, Select, Check Box, Radio Button, Date Picker and Color Picker.
How it works
wp-admin go to
Fields Factory -> Add Admin Field, 90 percent of the work flow is same with Product Fields creation.
Give a title to your Admin Fields Group.
Use Fields Factory section to add custom fields. you can add as much as fields you want. You can also rearrange the order of fields by drag and drop.
Use Condition section to add rules for this admin fields group, like you can assign this fields group to a particular product, category, tags, and product types. You can add as much as rules you want, and more than one rules can be combined with
Use Location section to place your admin fields group where it has to be inserted. you can place this Admin Fields to product section or to any product tabs section. like you can place these fields under
General product tabs or
Click “Publish” button, that’s it, your fields group will be added to all Woocommerce product’s admin screen ( of course whichever meets those rules you have added ).
How to access
Admin Product fields are stores as post meta ( here it’s product meta ), you can access any admin fields just like accessing any WordPress post meta. using
/* Post Id or Product Id will do */ $my_admin_field_val = get_post_meta( $post->ID, "wccaf_your_admin_field_name", true );
Accessing admin fields value which assigned for Variable tab section, you should be giving
$variable_id instead of
/* Variable id */ $my_admin_field_val = get_post_meta( $variable_id, "wccaf_your_admin_field_name", true );
*The key for the custom post meta always prefixed with
Product category custom fields will be stored as options. you can access those values like
$my_admin_product_cat_val = get_option( "taxonomy_product_cat_". $your_term_id ."_wccaf_". $your_field_name " );
How to render admin fields on front end product page
This feature is supported from V1.3.1, but you will have to enable it for each fields. by default all admin fields will not be displayed in front end product page ( as the intention for this Admin Field is to add custom fields for Back End Admin screen )
Show on Product Page
This option has to be enabled in order to show the field on front end.
Show on Cart & Checkout
This option has to be enabled in order to show this custom meta on cart & checkout page
Order Item Meta
This option has to be enabled in order to add this custom meta as order item meta ( which will be added in order email as well )