In the database
With each and every product there is a column named “stock_chk”
stock_chk value is 0 for sold out products
and
stock_chk value is 1 for available products?
We want when user click on the next or previous button: it should go the database to check the stock_chk value.
If it is 0, then it should go to the next until it finds value 1,
That means available product.
So we need your script for next and previous button.