I am trying to figure out how to have a product that is unavailable to customers, but has inventory, that I can access in product_template.liquid to check how many are left.
all_products['handle'] won't work if the product is unavailable but making the product available makes it so the customer has access to that product.
Does anyone know of a way to access unavailable products through code, or a way to hide a product from the customer when it is marked available?
we can edit the product template file by liquid with help of adding tags to product and make that product available or not available based on tag.
I can help you on this you can have a look on my proven work record at https://upwork.com/fl/niraj1420
You can simple create an alternate product template which basically doesn't; do anything and assign all such products, you want to make unavailable to this template.
Please see the documentation on how to create alternate template here, if you already do not know
If I am following correctly, that just changes the way the product page looks but the product still shows up on my Products page. Am i missing a step?
What I am trying to achieve is a backorder system. So my actual product, when a variant inventory reaches 0, it checks a backorder inventory (the hidden version of the product), and then allows the customer to backorder the item. This way I can limit the amount of total backorders without limiting quantity for each variant. Basically a global pool of backstock with a limitation on total ordered.