title: Magento 2 - sort by price
body: <p>I have a problem with a multistore site created with Magento 2.4. Right now the products from the category page and the search page are arranged by name. The options for sorting are: Alphabetical A - Z and Z - A, and by price from low to high and high to low. When I try to sort the products alphabetical everything works fine, but when I try by price it's like a random sort. I also put a custom module but the same result. Instead, if I sort them by product id or by weight it is ok.</p>
  <pre><code>if ($currentOrder) {
              if ($currentOrder == 'price_asc') {
                  $subject-&gt;getCollection()-&gt;setOrder('price', 'asc');
              } elseif ($currentOrder == 'price_desc') {
                  $subject-&gt;getCollection()-&gt;setOrder('price', 'desc');
              } elseif ($currentOrder == 'name_asc') {
                  $subject-&gt;getCollection()-&gt;setOrder('name', 'asc');
              } elseif ($currentOrder == 'name_desc') {
                  $subject-&gt;getCollection()-&gt;setOrder('name', 'desc');
              }
          }
  </code></pre>
  <p>I also put <code>-&gt;getStoreId(1)</code> after <code>getCollection()</code> but I have same the result. Edit: from what I saw instead of sort by price it's a sort by product id</p>