Sort by price wpdb
Replace $args = array( ‘post_type’ => array(‘product’, ‘product_variation’), ‘post_status’ => ‘publish’, ‘posts_per_page’ => get_option(‘posts_per_page’), ‘paged’ => $paged, ‘tax_query’ => $tax_query, ‘orderby’ => ‘price’, ‘order’ => ‘asc’, ); New code $orderby = $_GET[‘orderby’] ?? ”; $args = array( ‘post_type’ => array(‘product’, ‘product_variation’), ‘post_status’ => ‘publish’, ‘posts_per_page’ => get_option(‘posts_per_page’), ‘paged’ => $paged, ‘tax_query’ => $tax_query ); if … Read more