Viewing 8 replies - 1 through 8 (of 8 total)
  • Remi Corson

    (@corsonr)

    Automattic Happiness Engineer

    Hi @gossie,

    If I am capturing this correctly, you’d like to make sure that out of stock products aren’t linked via the next/prev button.

    The point here is that the code you’re using is a WordPress native function that treats products as items, not as product and thus use basically next/prev IDs from the same content type entries.

    In other words there’s no link to the item data (such as stock). You’ll need a more advanced query, something like this instead:

    https://gist.github.com/georgybu/4285005

    Thread Starter gossie

    (@gossie)

    Hi Remi, thanks for your reply

    I tested the code from github but this doesn’t work unfortunately. I don’t even see the buttons next and buttons on the single product page.

    You are sure that the code from businessbloomer cannot be modified in order to show only the products in stock ?

    Remi Corson

    (@corsonr)

    Automattic Happiness Engineer

    Hi @gossie,

    The code from GitHub needs to be adjusted, it’ the query part to get products that are in stock, but you need to combine this code with the one that you already found (the one that adds the buttons)

    Thread Starter gossie

    (@gossie)

    I have added both codes into 2 separate snippets, but it gives the same result ??

    Remi Corson

    (@corsonr)

    Automattic Happiness Engineer

    Hi @gossie,

    Sorry, my previous message wasn’t clear, you need to combine them into one and adjust them all together ??

    Thread Starter gossie

    (@gossie)

    so not just copy paste 1 code below the other ? but really combining and mixing them into 1 code ?

    Remi Corson

    (@corsonr)

    Automattic Happiness Engineer

    Hi @gossie,

    Exactly, that would create a custom snippet, but then it requires a few PHP knowledge. Since I can’t do the code for you maybe you can ask on StackOverflow or wait for someone from the community to do it for you.

    Remi Corson

    (@corsonr)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Next/previous button on single product page’ is closed to new replies.