bleroy / Nwazet.Commerce

Idiomatic commerce module for Orchard CMS.
BSD 3-Clause "New" or "Revised" License
26 stars 21 forks source link

Additional inventory option for digital products #97

Closed MatteoPiovanelli-Laser closed 7 years ago

MatteoPiovanelli-Laser commented 7 years ago

In working with the module, I found myself wondering about the relation between digital products and inventory.

Some digital products may have a limited availability (e.g. tickets to a theatre). Some may be available in unlimited quantities (e.g. winrar licenses).

As things are, the way this could be handled is by setting the inventory of products in the second category to a very large number, and/or allowing back-order. Since merging in #93, that would leave a label in cart views telling that the product is out of stock, when it really is not.

So I made a few changes, for which I will do a PR momentarily, that allows clearer handling of digital products. Basically, I added a boolean to ProductPart called ConsiderInventory: when checked for a digital product it causes the product to be treated as belonging in the category of theatre tickets. If left unchecked, the digital product is assumed to be in the winrar license category. The flag does nothing for non-digital products.