Variations or menus are not being saved: increase max_input_vars
You're editing a product with many variations, or a large menu in WordPress, and you click Update. You don't see an error message, but after reloading, part of your changes is gone: the last variations have their old price, or items are missing from the bottom of the menu. The cause is almost always the PHP setting max_input_vars.
What is max_input_vars?
When saving, your browser sends all the fields of the form to the server at once. For a variable product, that means many fields per variation: price, stock, SKU, weight and more. For a large menu, each menu item counts a number of fields. PHP only accepts a certain number of fields per request: that's max_input_vars. PHP itself defaults to 1000. If more fields come in, PHP drops the rest without any warning. WordPress and WooCommerce then only save what did come through.
WooCommerce shows 15 variations per page in the admin to limit this. With many attributes and fields you can still hit the limit.
Checking your current value
- In WooCommerce: WooCommerce > Status, under PHP Max Input Vars.
- In DirectAdmin: Select PHP version, tab Options, under
max_input_vars.
Increasing max_input_vars with WebOké
- Log in to DirectAdmin: in My WebOké, go to My Products and click DirectAdmin next to your hosting package.
- Under Extra Features, click Select PHP version.
- Check that the version your site uses is selected. Options are set per PHP version.
- Go to the Options tab, click the value next to
max_input_varsand choose a higher value, for example3000or5000. - The change is saved immediately and applies to all sites in your package using that PHP version.
If the PHP version is set to native, you can't change anything under Options. In that case, choose a fixed version first. For an explanation with screenshots, see PHP options: upload_max_filesize, memory_limit and max_execution_time and Changing PHP version and PHP settings (and what to do about errors after an upgrade).
Rather not look this up yourself? The AI assistant in My WebOké can adjust max_input_vars for you for the PHP version your package uses. You'll see what changes first and approve it yourself.
Checking whether it works
- Check under WooCommerce > Status whether the new value is there.
- Is the old value still showing? Check whether your
.htaccesshas an oldphp_value max_input_varsrule, or whether a custom value for your domain has been set under PHP Settings in DirectAdmin. Those take priority. See PHP Settings in DirectAdmin or Select PHP version: what's the difference? - Edit the product or menu again, save, and check after reloading whether everything has been kept. Anything already lost will need to be filled in again.
Further reading
- PHP manual: max_input_vars (English)
