Now that we have our basic integration setup, we need to add our fields. So far, everything we've written will work for just about any integration. Now we're going to write code for the specific settings our integration needs. Follow these steps:
- Let's start with a function to create the fields:
/** * Initialize integration settings form fields. * * @return void */ public function init_form_fields() { }
- Now we can add the settings to this function. Let's add one setting first. Add a field for our API key. We're going to create an array called form_fields and add all of our fields to that array:
$this->form_fields = array( 'api_key' => array( 'title' => __( 'API Key', 'woocommerce-integration-demo' ), 'type' => 'text', ...