add_action( ‘woocommerce_product_query’, ‘react2wp_hide_products_higher_than_zero’ );
function react2wp_hide_products_higher_than_zero( $q ){
$meta_query = $q->get( ‘meta_query’ );
$meta_query[] = array(
‘key’ => ‘_price’,
‘value’ => 0,
‘compare’ => ‘>’
);
$q->set( ‘meta_query’, $meta_query );
}
add_action( ‘woocommerce_product_query’, ‘react2wp_hide_products_without_price’ );
function react2wp_hide_products_without_price( $q ){
$meta_query = $q->get( ‘meta_query’ );
$meta_query[] = array(
‘key’ => ‘_price’,
‘value’ => ”,
‘compare’ => ‘!=’
);
$q->set( ‘meta_query’, $meta_query );
}
Bài viết mới:
- 10 chế độ ẩn của Windowns mà bạn đã thử chưa?
- Các hàm ob_start(), ob_get_contents(), ob_clean(), ob_end_flush() trong PHP
- Hiển thị ngày giờ bài viết post của wordpress
- Table responsive cho các thiết bị mobile table, thay thế table cho flatsome
- Các hàm Hooks (Actions & Filters) trong theme Flatsome thần thánh





