Support » Plugin: WooCommerce Extra Product Sorting Options » Sort by Stock Availability & Date

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Beka Rice

    (@bekarice)

    Hey @tuleburg, I’m afraid this isn’t possible without custom code. By default, the plugin sorts by stock, then by title.

    Sorry I don’t have better news for you here!

    If you absolutely needed to make this change, there are filters in place that could be used by a developer to change this, but you’d need custom code to do so. The wc_extra_sorting_options_fallback and wc_extra_sorting_options_fallback_order filters can do what you’re asking to change the fallback and its order to use date / DESC instead. I typically recommend Codeable for these sort of small projects if you don’t already work with a developer.

    Cheers!

    Hello Beka,

    No worries, we did some custom code:

    wc_extra_sorting_options_fallback – Worked Great
    add_filter( ‘wc_extra_sorting_options_fallback’, ‘sv_change_sorting_fallback’ );
    function sv_change_sorting_fallback( $fallback ) {
    return ‘date’;
    }

    wc_extra_sorting_options_fallback_order – Changing to DESC didn’t do anything
    add_filter( ‘wc_extra_sorting_options_fallback_order’, ‘sv_change_sorting_fallback_order’ );
    function sv_change_sorting_fallback_order( $fallback_order ) {
    return ‘desc’;
    }

    Thoughts?

    Thank you!

    Hello Beka,

    Just wanted to follow up on my latest reply.

    Thank you,

    Plugin Author Beka Rice

    (@bekarice)

    Hey @tuleburg, I don’t see anything in particular wrong with what you’ve posted, this would need some further debugging to see why the fallback order isn’t being used. I’m afraid we can’t debug custom code here.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Sort by Stock Availability & Date’ is closed to new replies.