• Resolved patchyart

    (@patchyart)


    Hi,

    We have it set up so that the filter displays in a widget on desktop and on mobile the filter is controlled by the filter button.

    However, how do we change where the filter button appears as right now it appears at the top of the page and we want it to appear in the woocommerce hook ‘woocommerce_before_shop_loop’

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 5 replies - 16 through 20 (of 20 total)
  • Thread Starter patchyart

    (@patchyart)

    Hi,

    Thank you for getting back to us so quickly!

    Regarding the AJAX mode, we have been using the Dedicated Ajax Mode

    Best,

    Leo

    Plugin Author annastaa

    (@annastaa)

    Hello again Leo,

    To edit the orderby clause of the filters’ AJAX calls in the dedicated mode, try this:

    if( wp_doing_ajax() && isset( $_REQUEST['awf_front'] ) && isset( $_REQUEST['awf_action'] ) && 'filter' === $_REQUEST['awf_action'] ) {
    
      if( isset( $_REQUEST['awf_ajax_extras']['orderby_seed'] ) ) {
        add_filter( 'woocommerce_shortcode_products_query', function( $args, $attrs, $type ) {
          $args['orderby'] = 'RAND('. intval($_REQUEST['awf_ajax_extras']['orderby_seed']) . ')';
          $args['order'] = '';
        
          return $args;
        }, 100, 3 );
      }
    
    }

    Of course, you will need to take care of the seed value appearing only when the random ordering is active and any possible other conditions, but this should work as a blueprint. You could also try the posts_orderby hook, but in this case your misha_rand_order_with_seed function would have to be changed quite a bit to become applicable to the AJAX case.

    Good luck!

    Thread Starter patchyart

    (@patchyart)

    Thank you, we will try to have a play around with the code provided to try and get it working

    If you guys ever added this as a feature to the premium version i would definitely upgrade as its a great feature to add

    Plugin Author annastaa

    (@annastaa)

    Leo,

    I will mark this as a feature request, for us to look into the possibility of adding custom orderby options at some point in the future.

    Meanwhile, I hope you will find the way to hook your custom code, please let us know here if you do!

    Plugin Author annastaa

    (@annastaa)

    Hello Leo,

    I will go ahead and close this inactive thread, but please feel free to re-open it or create a new topic if you have anything else to add to this discussion.

    Have a great day!

Viewing 5 replies - 16 through 20 (of 20 total)
  • The topic ‘How to control where the filter button appears’ is closed to new replies.