WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: Woocommerce] Make a "Products per page" dropdown (4 posts)

  1. DesignLoud
    Member
    Posted 1 year ago #

    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!

  2. damian.smith
    Member
    Posted 1 year ago #

    Did you get anywhere with this?

    I am also looking into how this can be done.

  3. DesignLoud
    Member
    Posted 1 year ago #

    Hey damian, I did get it working flawlessly and have recently put a tut up on my site, super easy to customize.. I will have to try to put it in a plugin soon or just build it in to the woocommerce radio buttons plugin that we will be updating soon..

    Here is the link: http://designloud.com/how-to-add-products-per-page-dropdown-to-woocommerce/

    Good luck!

  4. damian.smith
    Member
    Posted 1 year ago #

    Star!

Topic Closed

This topic has been closed to new replies.

About this Topic