1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Add-on fields not saving
  1. Home
  2. Knowledge Base
  3. Troubleshooting Add-Ons Ultimate
  4. Add-on fields not saving

Add-on fields not saving

If you find that your add-on fields are not saving correctly, it’s possible that you have too many fields for WordPress to save reliably.

The plugin itself does not have a limit or maximum to the number of fields you can add.

However, PHP (which WordPress runs on) has a setting called max_input_vars which limits the amount of data that can be passed to the server when submitting a form. This means that some of your data, e.g. your add-on fields, is truncated and not saved correctly.

Increase PHP max_input_vars setting

To get round this, you can increase the max_input_vars setting on your server. You might need to contact your host to arrange this.

The default is usually set to 1000. You can try increasing this to 3000, then 5000 if necessary.

How to check your max_input_vars setting

You can check the value of the max_input_vars setting by going to WooCommerce > Status, scrolling down to the ‘Server Environment’ section, and checking the value of ‘PHP max input vars’.

max input vars

There’s a longer article on this issue in WooCommerce in general here.

Remove certain field parameters

Another way to increase the number of add-on fields that can be saved is to exclude certain parameters. For example, if you are not using calculation fields in your add-on fields, you can exclude any parameters related to calculations as below:

<?php
// Use this if you are not using calculation fields
add_filter( 'pewc_show_calculation_params', '__return_false' );
// Use this if you are not using any fields with options, e.g. radio, select
add_filter( 'pewc_show_option_field_params', '__return_false' );
// Use this if you are not using information fields
add_filter( 'pewc_show_information_params', '__return_false' );
// Use this if you are not using checkbox group fields
add_filter( 'pewc_show_checkbox_group_params', '__return_false' );
// Use this if you are not using child products fields
add_filter( 'pewc_show_products_params', '__return_false' );
// Use this if you are not using image swatch fields
add_filter( 'pewc_show_image_swatch_params', '__return_false' );
// Use this if you are not using upload fields
add_filter( 'pewc_show_upload_params', '__return_false' );
// Use this if you are not using text fields with character parameters
add_filter( 'pewc_show_character_params', '__return_false' );
// Use this if you are not using number fields
add_filter( 'pewc_show_number_params', '__return_false' );
// Use this if you are not using date fields
add_filter( 'pewc_show_date_params', '__return_false' );

Was this article helpful?

Related Articles