Quote from IgorA100 on July 15, 2021, 15:54
Unfortunately
For myself, I implemented the opportunity to choose empty, not empty, existing in the goods and missing meta fields. I did this:
\ext\meta\meta.php - changed the function to :
[spoiler]
public function woobe_filter_text($data) {
$metas = $this->get_fields();
if (!empty($metas)) {
foreach ($metas as $m) {
if (in_array($m['meta_key'], $this->settings->get_fields_keys())) {
if ($m['type'] == 'string') {
$data[$m['meta_key']] = array(
'placeholder' => $m['title'],
'direct' => TRUE,
'behavior_options' => array(
'LIKE' => __('LIKE', 'woocommerce-bulk-editor'),
'=' => __('EXACT (=)', 'woocommerce-bulk-editor'),
'!=' => __('NOT EXACT (!=)', 'woocommerce-bulk-editor'),
'NOT LIKE' => __('NOT LIKE', 'woocommerce-bulk-editor'),
'empty' => __('Empty', 'woocommerce-bulk-editor'), //IgorA100
'not_empty' => __('NOT empty', 'woocommerce-bulk-editor'), //IgorA100
'empty_not_exists' => __('Empty && NOT EXISTS', 'woocommerce-bulk-editor'), //IgorA100
'not_empty_exists' => __('NOT empty && EXISTS', 'woocommerce-bulk-editor'), //IgorA100
'exists' => __('EXISTS', 'woocommerce-bulk-editor'), //IgorA100
'not_exists' => __('NOT EXISTS', 'woocommerce-bulk-editor'), //IgorA100
),
'css_classes' => 'not-for-variations'
);
}
}
}
}
return $data;
}
[/spoiler]
and in functions "\ext\filters\filters.php public function woobe_apply_query_filter_data($args)" made add-ons :
[spoiler]
if ($woobe_filter[$string_key]['behavior'] == 'empty'
|| $woobe_filter[$string_key]['behavior'] == 'empty_not_exists'
|| $woobe_filter[$string_key]['behavior'] == 'not_exists'
|| $woobe_filter[$string_key]['behavior'] == 'exists') $is = true;
[/spoiler]
AND:
[spoiler]
// +++++ IgorA100
} elseif ($woobe_filter[$string_key]['behavior'] == 'empty') {
$meta_query[] = array(
'key' => $fields[$string_key]['meta_key'],
'value' => '',
'compare' => '='
);
} elseif ($woobe_filter[$string_key]['behavior'] == 'not_empty') {
$meta_query[] = array(
'key' => $fields[$string_key]['meta_key'],
'value' => '',
'compare' => '!='
);
} elseif ($woobe_filter[$string_key]['behavior'] == 'empty_not_exists') {
$meta_query[] = array(
'relation' => 'OR',
array(
'key' => $fields[$string_key]['meta_key'],
'value' => '',
'compare' => '='
),
array(
'key' => $fields[$string_key]['meta_key'],
'compare' => 'NOT EXISTS'
)
);
} elseif ($woobe_filter[$string_key]['behavior'] == 'not_empty_exists') {
$meta_query[] = array(
'relation' => 'OR',
array(
'key' => $fields[$string_key]['meta_key'],
'value' => '',
'compare' => '!='
),
array(
'key' => $fields[$string_key]['meta_key'],
'compare' => 'EXISTS'
)
);
} elseif ($woobe_filter[$string_key]['behavior'] == 'not_exists') {
$meta_query[] = array(
'key' => $fields[$string_key]['meta_key'],
'compare' => 'NOT EXISTS'
);
} elseif ($woobe_filter[$string_key]['behavior'] == 'exists') {
$meta_query[] = array(
'key' => $fields[$string_key]['meta_key'],
'compare' => 'EXISTS'
);
[/spoiler]
I'm not sure what I did everything correctly, but nevertheless everything began to filtered more universally.
I could not add a formatted code here, because of what the code here is now poorly read. :(
You could not make similar changes in the plugin? Or introduce hooks, in which you would make such changes? It will not be very convenient, add such lines after updating your plugin.