diff --git a/gp-inventory/gpi-waiting-list.php b/gp-inventory/gpi-waiting-list.php index 22b373ca3..9cdd6ae4f 100644 --- a/gp-inventory/gpi-waiting-list.php +++ b/gp-inventory/gpi-waiting-list.php @@ -63,6 +63,9 @@ public function add_hooks() { add_filter( 'gform_field_input', array( $this, 'remove_gform_field_input_filters' ), 15, 2 ); add_filter( 'gform_pre_render', array( $this, 'add_waiting_list_to_single_product' ) ); + + // Allow negative stock to be used for conditional logic validation. + add_filter( 'gpi_allow_negative_stock', array( $this, 'allow_negative_stock_for_conditional_logic' ), 10, 3 ); } public function is_applicable_form( $form ) { @@ -259,6 +262,14 @@ public function add_waiting_list_to_single_product( $form ) { return $form; } + public function allow_negative_stock_for_conditional_logic( $allow_negative_stock, $target_field, $form ) { + if ( ! $this->is_applicable_form( $form ) ) { + return $allow_negative_stock; + } + + return true; + } + } new GPI_Waiting_List();