How to fetch woocommerce highest price and lowest price in custom template page?

This should do the job. $products = get_posts(array( ‘post_type’ => ‘product’, ‘post_status’ => ‘publish’, ‘orderby’ => ‘meta_value_num’, ‘meta_key’=> ‘_price’, ‘posts_per_page’ => -1, )); $highest = $products[array_key_first($products)]; $lowest = $products[array_key_last($products)]; $highest_price = get_post_meta( $highest->ID, ‘_price’, true ); $lowest_price = get_post_meta( $lowest->ID, ‘_price’, true );