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:
- Truy xuất thông tin giỏ hàng từ đối tượng $cart trong woocommerce
- Thêm class active cho thẻ a đang trùng với link hiện tại của website
- Thực thi & hiển thị shortcode trong mô tả danh mục (archive description), tag ….
- Tạo 1 title UX Builder đơn giản, hiển thị danh mục sản phẩm woocommerce
- Tạo shortcode trong wordpress