gpi_quantity_input_ids

  1. Description
  2. Usage
  3. Parameters
  4. Examples
    1. Set Requested Quantity by Field Value
  5. Since

Description

Filter the input IDs that are used as the quantity for the field.

Usage

Filter the input IDs that are used as the quantity for all inventory fields.

add_filter( 'gpi_quantity_input_ids', 'my_custom_function' );

Filter the input IDs that are used as the quantity for all inventory fields in a form.

add_filter( 'gpi_quantity_input_ids_FORMID', 'my_custom_function' );

Filter the input IDs that are used as the quantity for a specific inventory field.

add_filter( 'gpi_quantity_input_ids_FORMID_FIELDID', 'my_custom_function' );

Parameters

  • input_ids int[]

    The input IDs that are used as the quantity for the field.

  • field \GF_Field

    The current field.

Examples

Set Requested Quantity by Field Value

<?php
/**
 * Gravity Perks // Inventory // Set Requested Inventory by Field Value
 * https://gravitywiz.com/documentation/gravity-forms-inventory/
 */
// Update "123" to your form ID and "4" to your Inventory-enabled field.
add_filter( 'gpi_quantity_input_ids_123_4', function( $input_ids, $field ) {
	// Update "5" to the ID of the field that should be used to specify the quantity.
	return array( 5 );
}, 10, 2 );

Since

This filter is available since Gravity Forms Inventory 1.0-beta-3.23.