title: Multiple filtering and sort by in Shopify liquid
body: <p>I am trying to merge storefront filtering and sorting in my custom theme collections page in Shopify.</p>
  <p>Both things work, but the 'sort_by' parameters are overwriting the filtering ones when these are multiple.</p>
  <p>i.e of how the URL should look once filtering with two parameters (sizes XXS and XL) and sorting by ascending price:</p>
  <p><em>../collections/new-arrivals?filter.v.option.size=XXS&amp;filter.v.option.size=XL&amp;sort_by=price-ascending</em></p>
  <p>But this is what happens when sorting:</p>
  <p><em>../collections/new-arrivals?filter.v.option.size=XXS&amp;sort_by=price-ascending</em></p>
  <p>Second filtering parameter gets overwritten by the sorting one.</p>
  <p>Pasting below my code for the JS piece that triggers the sorting behaviour.</p>
  <pre><code>// sortby
  $(function() {
  Shopify.queryParams = {};
  if(location.search.length) {
  for(var aKeyValue, i = 0, aCouples = location.search.substr(1).split('&amp;'); i &lt; aCouples.length; i++) {
  aKeyValue = aCouples[i].split('=');
  if (aKeyValue.length &gt; 1) {
  Shopify.queryParams[decodeURIComponent(aKeyValue[0])] = decodeURIComponent(aKeyValue[1]);
  }
  }
  }
  
  document.querySelector('.sort-by').addEventListener('change', function(e) {
  var value = e.currentTarget.value;
  Shopify.queryParams.sort_by = value;
  location.search = new URLSearchParams(Shopify.queryParams).toString();
  });
  })
  </code></pre>
  <p>Has someone ever tried to achieve something like this?
  I would appreciate any help.</p>
  <p>Thanks in advance,</p>