WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
moving the product sorting above the products (12 posts)

  1. mariaarty
    Member
    Posted 1 year ago #

    i want to move the sorting form .woocommerce_ordering from under the products to up in the page over the products, how can i do that? any help please

    http://wordpress.org/extend/plugins/woocommerce/

  2. bheadrick
    Member
    Posted 1 year ago #

    you just need to edit the archive-product.php template file
    or, you could add this to your themes functions.php:

    remove_action('woocommerce_pagination','woocommerce_catalog_ordering');
    add_action('woocommerce_before_shop_loop','woocommerce_catalog_ordering');
  3. mariaarty
    Member
    Posted 1 year ago #

    thanks for answering, but this code added a sorting over the product but it didn't remove the one under them, now i have 2

  4. mariaarty
    Member
    Posted 1 year ago #

    i have added this code in the woocommerce-template.php

    /**
    * Replace WooCommerce Default Pagination with WP-PageNavi Pagination
    *
    */
    remove_action('woocommerce_pagination', 'woocommerce_pagination', 10);
    function woocommerce_pagination() {
    wp_pagenavi();
    }
    add_action( 'woocommerce_pagination', 'woocommerce_pagination', 10);

    could this be why it doesn't remove the one under the page?
    and i tried to edit in the archive-product.php, but nothing really happens, thanks for your help...

  5. mariaarty
    Member
    Posted 1 year ago #

    hey guys i would really love to get red of the bottom sorting, any help....

    also does anybody knows how to remove this sorting from the category pages, i only have 2 categories and i don't need the sorting there, and diffenetly not 2 :P

    any help, thanks

  6. bheadrick
    Member
    Posted 1 year ago #

    you should probably change your function name to something that doesn't overlap with an action name to avoid confusion, but the reason the one at the bottom isn't going away is because you're not removing it. This is w hat you need to remove the one at the bottom.

    remove_action('woocommerce_pagination','woocommerce_catalog_ordering');

  7. mariaarty
    Member
    Posted 1 year ago #

    if ( ! function_exists( 'woocommerce_catalog_ordering' ) ) {

    /**
    * Output the product sorting options.
    *
    * @access public
    * @subpackage Loop
    * @return void
    */
    function woocommerce_catalog_ordering() {
    if ( ! isset( $_SESSION['orderby'] ) )
    $_SESSION['orderby'] = apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
    woocommerce_get_template( 'loop/sorting.php' );
    }
    }

    this is the code in the woocommerce-template.php
    i don't know how to stop showing this sorting, this code doesn't remove the sorting, the add_action works but the remove doesn't

    so any ideas...?

  8. bheadrick
    Member
    Posted 1 year ago #

    I just confirmed this works:

    remove_action('woocommerce_pagination', 'woocommerce_pagination', 20);

  9. mariaarty
    Member
    Posted 1 year ago #

    still doesn't remove it :(

  10. viktor-photo
    Member
    Posted 1 year ago #

    I found solution!
    To get rid of the bottom sorting, just add to your themes functions.php:

    remove_action('woocommerce_pagination','woocommerce_catalog_ordering', 20);

  11. Aichels
    Member
    Posted 1 year ago #

    It just adde another drop down in bottom of page. It doesn't remove old one or insert new on top.

    Maybe this worked on previous versions of woocommerce, does anyone now how to do it for latest version?

  12. cycas
    Member
    Posted 10 months ago #

    I know this is a bit old, but I just had a similar niggle, so thought I'd respond. In order for the remove to work, you have to specify correctly where 'woocommerce_catalog_ordering' is hooked.

    If you tried this:
    remove_action('woocommerce_pagination','woocommerce_catalog_ordering', 20);

    and it didn't work, then that's probably because your 'woocommerce_catalog_ordering' isn't hooked onto woocommerce_pagination, or if it is, it isn't hooked at position 20.

    The reason this worked for other people but not for you is probably that their theme did have 'woocommerce_catalog_ordering' hooked at that position.

    What I did was look in woocommerce/template/archive-product.php where I saw on line 40 that woocommerce_catalog_ordering was hooked at position 30 to woocommerce_before_shop_loop. I doublechecked this against woocommerce-hooks.php, and yes, there was 'woocommerce_catalog_ordering'at position 30, and nothing anywhere else changing that.

    So, what worked for me was:
    remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering',30);

    This probably won't work for you, because your form is at the bottom, so it probably isn't hooked to woocommerce_before_shop_loop. You need to find out what it is hooked onto, and where. I suggest you do a global search for woocommerce_catalog_ordering - probably somewhere in your theme, will be a line that says something like :

    add_action( 'functionhookedto', 'woocommerce_catalog_ordering', 30 );

    Once you've found that, you should be able to unhook it in your functions.php. I hope that makes sense!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic