1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Filter validation message for maximum number of child products
  1. Home
  2. Knowledge Base
  3. Advanced
  4. Filter validation message for maximum number of child products

Filter validation message for maximum number of child products

There are multiple filters available for changing the validation messages. Here’s an example of how to filter the validation message when the maximum number of child products has been exceeded.

<?php
/**
* Filter validation message for maximum number of child products
*/
function prefix_filter_max_children_validation_notice( $message, $field_label, $max_products ) {
// You can write a custom message here
// $field_label is the name of the field
// $max_products is the maximum number of products allowed
return $message;
}
add_filter( 'pewc_filter_max_children_validation_notice', 'prefix_filter_max_children_validation_notice', 10, 3 );

You can update the $message variable to whatever you like. Use the $field_label and $max_products variables in your message if required.

Here’s how to add a snippet.

Was this article helpful?

Need More Support?

If you can't find the answer that you're looking for, then please use the link below to raise a support ticket.
Contact Support

Related Articles