• Resolved rasidrsd

    (@rasidrsd)


    Hey guys,

    i am really confuse right now.
    I have tried to remove the Sort by price option, with

    // Edit WooCommerce dropdown menu item of shop page//
    // Options: menu_order, popularity, rating, date, price, price-desc
     
    function rsd_catalog_orderby( $orderby ) {
        unset($orderby["price"]);
        unset($orderby["price-desc"]);
        return $orderby;
    }
    add_filter( "woocommerce_catalog_orderby", "rsd_catalog_orderby", 20 );

    but it does not work.
    Currently I have WooCommerce 2.6.11 isntalled.
    (Booster for Woocommerce 2.5.9 | Booster Plus 1.1.0 installed too)

Viewing 6 replies - 1 through 6 (of 6 total)
  • Worked for me.

    Make sure you put the code in functions.php for your child theme.

    Maybe your theme is also using this filter and overriding your function. Just try 99 instead of 20 for the priority parameter.

    Next, try:

    function rsd_catalog_orderby( $orderby ) {
      unset($orderby["price"]);
      unset($orderby["price-desc"]);
      var_dump($orderby);
      return $orderby;
    }
    add_filter( "woocommerce_catalog_orderby", "rsd_catalog_orderby", 20 );
    

    If you don’t see the array printed just before the drop-down, then the filter is not being called.

    Please post the url for your shop page.

    Thread Starter rasidrsd

    (@rasidrsd)

    Priority 99 doesn’t work.
    The var_dump array is not displayed. So how can I override the Theme?

    My best guess then is that your theme has a template override which doesn’t call the filter. To test this, switch to Storefront. Deactivate other plugins. Does the code work now?

    Please post the url for your shop page. If you are using a www.remarpro.com theme the code should be available. If you are using a commercial theme I’m stuck because www.remarpro.com forum members don’t have access to commercial themes.

    Thread Starter rasidrsd

    (@rasidrsd)

    Yes, it works perfectly with Storefront.

    I am using a purchased theme “Enfold by Envato”.
    So I can’t remove it? Maybe by adding the Filter anywhere?

    https://rasidsspielwiese.tk/

    On your shop page, the orderby options are not the standard ones, so it looks like Enfold is doing things its own way. With it being a commercial theme, the code is not available to www.remarpro.com forum members, we’re just blind on this, so you’re on your own. If you can’t figure it, you can hire someone:
    https://jobs.wordpress.net/
    Competition is fierce and you’re not obliged to accept any quotation.

    Thread Starter rasidrsd

    (@rasidrsd)

    Alright, thank you.
    I’ll try to get some answers in the Enfold Forum.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove “Sort by Price”’ is closed to new replies.