• Resolved DesignLoud

    (@designloud)


    Hi all, I am trying to setup a dropdown to sort the number of products per page and I cant seem to get the kinks worked out.

    Here is what I have so far, but it doesn’t work and didnt know if someone knew of a workable solution?

    function woocommerce_sortby_page() {
    
    	if ('woocommerce_catalog_page_ordering'==$twelve)
      {
      add_filter('loop_shop_per_page', create_function('$cols', 'return 12;'));
      }
    elseif ('woocommerce_catalog_page_ordering'==$sixteen)
      {
      add_filter('loop_shop_per_page', create_function('$cols', 'return 16;'));
      }
    else
      {
      add_filter('loop_shop_per_page', create_function('$cols', 'return 4;'));;
      }
    }
    
    function woocommerce_catalog_page_ordering() {
    ?>
    <form action="<?php 'woocommerce_sortby_page' ?>">
    <select name="woocommerce-sort-by-columns">
    <option value="<?php $twelve ?>">12</option>
    <option value="<?php $sixteen ?>">16</option>
    </select>
    </form>
    <?php
    }
    
    add_action( 'woocommerce_pagination', 'woocommerce_catalog_page_ordering', 20 );

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Woocommerce] Make a "Products per page" dropdown’ is closed to new replies.