Hi,
I don't see an automatic solution with variants of a product.
A solution would be to have 3 different products:
- You would have product A, which would be the book, with a stock.
- You would have product B, which would be the PDF, with its stock set to unlimited.
- And you would have product C, which would be the book + PDF. In it, in the "bundled products" section, you could add product A and product B. That way, when the customer would purchase product C, it would update the stock of product A too. And since product B has an unlimited stock, it wouldn't change anything.
And if you want the customers to be able to switch from one of the three products to another on the product page on the frontend, then you could add them in the "related products" setting of each other.
Another solution would be to have the stock in the main product for all 3 variants, and when you're notified by the website that the product is out of stock (with the out of stock plugin), you then manually edit the product, set the book and book+PDF variants to 0 and the main product to unlimited. That way, only PDF variant will be available. If you don't have a lot of products that often go out of stock, that might be manageable.