How to create a custom field using ACF
When we need to show an extra field in our WooCommerce Product we should create a custom field.
Time needed: 5 minutes
To create custom fields you need to install first Advanced Custom Fields plugin.
After installation, you will see a new menu ACF added in the WordPress dashboard.
- First click on the Fields Group
From ACF menu click Field Froups option.
- Now click on "Add New."
To add a new field group, please click on Add New.
- Give Field Group a name.
The first step would be to give a proper name to the field groups to understand better.
- Set a fields
The next several steps will be about how to set up a field.
Field Type -> Select a type from the dropdown menu.
Field Label -> Give the field a name.
Field Name -> This is very important. Data will be saved by this name and you need to use this name to get data from the database.
Default Value -> Not necessary but you can set a default value from here.
- Settings rules.
You have to set the rules, where this custom field will be added.
- Save and publish.
After setting up everything, click on Save Changes. Field data will be safe and you will get a notification. ( Field group published )
Since I have set the custom field for the product, I will get an input box to add a custom field.