'Sort Products by Price in graphql api Laravel Shopify

I need to show products based on higher price to low price in shopify. I'm able to fetch products and its variants. However I need to show them based on the Price.How to achieve this in shopify using graphql api.

$srch2='{
  productVariants(first: 1, query: "sku:'.$ar.'") {
    edges {
      cursor
      node {
        id
        title
        inventoryQuantity
        price
        product {
          id
        }
        image {
          originalSrc
          id
        }
        selectedOptions{
          name
          value
        }
      }
    }
  }';
$srchres2 = $api->api()->graph($srch2);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source