gform_product_quantity

Description

Use this filter to change the sub-label for the Product Quantity input.

Usage

add_filter( 'gform_product_quantity', 'set_quantity_label', 10, 2 );

You can also target a specific form by adding the form id after the hook name.

add_filter( 'gform_product_quantity_6', 'set_quantity_label', 10, 2 );

Parameters

  • $sublabel string

    The sub-label to be filtered.

  • $form_id integer

    ID of current form.

Examples

This example changes the quantity sub-label to “How many:”.

add_filter( 'gform_product_quantity_185', 'set_quantity_label', 10, 2 );
function set_quantity_label( $sublabel, $form_id ) {
return 'How many:';
}

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

This filter is located in the following methods:

  • GF_Field_Calculation::get_field_input() in includes/fields/class-gf-field-calculation.php
  • GF_Field_SingleProduct::get_field_input() in includes/fields/class-gf-field-singleproduct.php