did you search around the functions get_adjacent_post() ?
A long time ago, I made a Woocommerce plugin (an old outdated Woocommerce product navigation on the repo) that use it in the same case and it used to work.
The class I created, use a fallback function to get all ids to exclude.
Hope it helps 😉