Reverse count page view and show on other page

It depends on what plugin(s) you are using.

Most ecommerce plugins do provide support for inventory. This means that as the shop owner, you can tell the plugin how many of product X you have in stock. Once someone buys an item, the plugin subtracts one, so if you start with 16 of the item and someone buys 1, then the plugin will automatically adjust the inventory to 15. This is better than relying on a pageview – if for example they leave the site to pay on PayPal’s website, many visitors don’t continue back to the original site and view the confirmation page that you were thinking of using to trigger the reduction of inventory.

As far as redirection, you would also need to create a child theme, and in that child theme’s product detail page (often single-product.php), you would need to set up a check before outputting any content. So, check the inventory of the current product, and if the inventory == 0, redirect to the page of your choice. Else, display the product detail page.