Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions gp-inventory/gpi-waiting-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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();
Expand Down
Loading