WooCommerce Settings API — a practical guide to WooCommerce Settings API with clear examples you can reuse in real projects.
WooCommerce Plugin Development Series (16/101). Prefer one article? Read the complete WooCommerce plugin development tutorial.
Short description
Use `woocommerce_admin_fields` style arrays for input types, defaults, and sanitization callbacks.
Settings fields sketch
$settings = [
[
'title' => 'Acme',
'type' => 'title',
'id' => 'acme_title',
],
[
'title' => 'API Key',
'id' => 'acme_api_key',
'type' => 'text',
'default' => '',
],
['type' => 'sectionend', 'id' => 'acme_title'],
];