Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
WooCommerce Plugin Development

WooCommerce Settings API

Define settings fields with WooCommerce’s settings field schema.

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'],
];

Leave a reply

Your email address will not be published. Required fields are marked *