- π¨πSwitzerland tcrawford
We encountered the same issue. Maybe we mis-configured the assignment of order item types. However, I think unless there is a important reason there is quite a bit of overhead to create different order items for licenses. Would there be any reason not to extend the guard / add a second guard to check if the purchased entity has a license type field? We are using this on a customer project with no adverse impacts to date.
```
// Skip purchasable entities that are not licenses.
if (!$order_item->getPurchasedEntity()->hasField('license_type') ||
$order_item->getPurchasedEntity()->get('license_type')->isEmpty()) {
return;
} - π¬π§United Kingdom joachim
> However, I think unless there is a important reason there is quite a bit of overhead to create different order items for licenses
You only need one order item type to work with licenses, so I don't see how that's a lot of overhead.
Commerce core allows different order item types precisely for this sort of functionality -- we get to define a field on the order item, which we need to licenses to work properly.
- πΊπΈUnited States herkimer
@tcrawford // #16
Thank you for posting this -- it works great on our site.
We enabled and configured the License module, sold about 150 license-enabled products, and THEN realized that we had botched the installation (did not create a specific Order Type for licenses). Our specific problem was similar to the above reports: that non-license products could not be added-to-cart in quantities > 1.
After re-tracing all of the README steps, it became clear that the only way to fix our mistake was a clean install -- and that would have really goofed-up the 150 already-existing customer orders.
Unless there are compelling reasons for not doing so -- it would be nice to see tcrawford's code added to the module. Thanks.