Home Forums Basel support forum How to change product navigation sorting and add endless loop?

How to change product navigation sorting and add endless loop?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #39974

    vinirossi
    Participant

    I guess that the current product navigation sorting is by product post id. This is not what I want, instead I would like to have the product navigation sorting same as my sorting in shop view. Or at least that the sorting is by name.

    Also I would like to have endless loop, which means that there will be always display 2 arrows.

    Could you suppose a way to achieve this?

    #39985

    Artem Temos
    Keymaster

    Hi,

    By default, the WooCommerce plugin doesn’t have products next/previous arrows functionality at all. To implement this feature we use standard WordPress PHP get_next_post and get_prev_post functions that can obtain adjacent posts from the database. Unfortunately, it takes products from the whole table and depends only on the shop page order. The system can’t know that you previously visited this product’s category page. Yes, it would be much better to show next/prev product from the same category. But how the system might know which one? The product can be from multiple categories. Then, from which category next product should be taken? Or for example, if I use filter by price or by color/size the order for products changes again. And naturally, that when you open some product from that page you must see products from the same color/size or from the same price filter interval. And there are a lot of such cases that make it impossible to make product arrows buttons work as expected.

    We spent a lot of time investigating this issue but, unfortunately, there is no solution for this problem. You can check any other theme for WooCommerce and you will see the same issue.

    Regards

    #40049

    vinirossi
    Participant

    Thank you for the detailed answer. Not that I can provide a fully consistent solution but maybe it could be interesting for you:

    As I can see from this Stackexchange there are a lot of filter possibilities when working with get_adjacent_post() instead of get_next_post()/get_prev_post().

    But yes the previous sorting to be passed to the single_product-page could be a serious problem. One solution could be saving the “current sorting-style” in a variable which will be pre-fetched to get_adjacent_post().

    All in all I agree that it would not be worth the effort.

    #40062

    Artem Temos
    Keymaster

    Yes, we tried all possible solution but it is not possible to make it work best for all cases. And we didn’t see working well products navigation on other WordPress sites as well.

Viewing 4 posts - 1 through 4 (of 4 total)