cwcfp_after_check_cart_quantities

The cwcfp_after_check_cart_quantities filter allows you to modify whether or not a field is repeated at all after the normal repeat calculation is done.

The filter is expected to return a 1 or a 0.

  • 1 = the field is allowed to repeat
  • 0 = the field is not allowed to repeat

There are six attributes passed to the filter:

  • $repeat - whether or not the field is allowed to repeat by default. Will be 1 or 0 as indicated above.
  • $qty_sum - the quantity of the field that will be displayed
  • $id - the field ID
  • $field - all of the settings for the field. This can retrieve data such as product IDs, whether or not the field is repeatable, etc.
  • $cart_data - provides information on the specific products, variations, etc. that are in the customer's cart.
  • $min_qty - the minimum quantity of a product required to be in the customer's cart before the field will be displayed.

This filter is useful for overriding the default behavior in the event that a customer purchases a large quantity of a product.

For example, if a customer purchases 100 units of a product, you may not want them to be required to fill out 100 fields (or more if there are several fields associated with that product) on your checkout page.

With this filter, you can check to see if the $qty_sum is greater than the max number of fields you would want the customer to fill out. If it is, the filter should return 0 to prevent any fields from being displayed. You can then request the customer provide the information in another manner after they made their purchase.