title: Adding products per page dropdown changes default products per page
body: <p>If I add the below code (taken from <a href="https://stackoverflow.com/a/55292815/4952851">this answer</a>) to my <code>functions.php</code> my default 'products per page' number changes from 15 to 10, and no matter what I do I can't seem to get it to change back to 15.</p>
  
  <p>The code I am adding is as below:</p>
  
  <pre><code>add_action( 'woocommerce_before_shop_loop', 'ps_selectbox', 25 );
      function ps_selectbox() {
          $per_page = filter_input(INPUT_GET, 'perpage', FILTER_SANITIZE_NUMBER_INT);     
          echo '&lt;div class="woocommerce-perpage"&gt;';
          echo '&lt;select onchange="if (this.value) window.location.href=this.value"&gt;';   
          $orderby_options = array(
              '15' =&gt; '15',
              '30' =&gt; '30',
              '45' =&gt; '45',
              '-1' =&gt; 'All'
          );
          foreach( $orderby_options as $value =&gt; $label ) {
              echo "&lt;option ".selected( $per_page, $value )." value='?perpage=$value'&gt;$label&lt;/option&gt;";
          }
          echo '&lt;/select&gt;';
          echo '&lt;/div&gt;';
      }
  
  add_action( 'pre_get_posts', 'ps_pre_get_products_query' );
  function ps_pre_get_products_query( $query ) {
     $per_page = filter_input(INPUT_GET, 'perpage', FILTER_SANITIZE_NUMBER_INT);
     if( $query-&gt;is_main_query() &amp;&amp; !is_admin() &amp;&amp; is_post_type_archive( 'product' ) ){
          $query-&gt;set( 'posts_per_page', $per_page );
      }
  }
  </code></pre>
  
  <p>I've tried adding different ways of setting the default products per page as well as the above, such as:</p>
  
  <pre><code>add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 );
  
  function new_loop_shop_per_page( $cols ) {
    $cols = 15;
    return $cols;
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>add_filter( 'loop_shop_per_page', 'lw_loop_shop_per_page', 30 );
  
  function lw_loop_shop_per_page( $products ) {
   $products = 15;
   return $products;
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>add_filter( 'loop_shop_per_page', create_function( '$products', 'return 15;' ), 30 );
  </code></pre>
  
  <p>etc. but still when I navigate to the shop page it always shows 10 products per page. <strong>The option to change the products per page does work</strong> but the default is always 10 instead of the 15 I need it to be.</p>
  
  <p>As soon as I remove the code to add the dropdown selection list, the problem goes away and it changes back to the 15 per page which is what is set via the Customizer settings.</p>
  
  <p>How can I make it stay at 15 per page default after adding the drop down select list to be able to change it?</p>