Skip to content

Commit 737b3f8

Browse files
committed
gpi-waiting-list.php: Fixed issue with conditional logic not working for negative stock.
1 parent a793843 commit 737b3f8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

gp-inventory/gpi-waiting-list.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ public function add_hooks() {
6363
add_filter( 'gform_field_input', array( $this, 'remove_gform_field_input_filters' ), 15, 2 );
6464

6565
add_filter( 'gform_pre_render', array( $this, 'add_waiting_list_to_single_product' ) );
66+
67+
// Allow negative stock to be used for conditional logic validation.
68+
add_filter( 'gpi_allow_negative_stock', array( $this, 'allow_negative_stock_for_conditional_logic' ), 10, 3 );
6669
}
6770

6871
public function is_applicable_form( $form ) {
@@ -259,6 +262,14 @@ public function add_waiting_list_to_single_product( $form ) {
259262
return $form;
260263
}
261264

265+
public function allow_negative_stock_for_conditional_logic( $allow_negative_stock, $target_field, $form ) {
266+
if ( ! $this->is_applicable_form( $form ) ) {
267+
return $allow_negative_stock;
268+
}
269+
270+
return true;
271+
}
272+
262273
}
263274

264275
new GPI_Waiting_List();

0 commit comments

Comments
 (0)