- Issue created by @jsacksick
- First commit to issue fork.
- 🇮🇱Israel jsacksick
One cool addition could be to change the UX for creating order items.
For example, instead of offering an order item type select list, we could first require referencing the purchasable entity, and then call the the createFromPurchasableEntity() method, so that the order item type is determined based on the purchasable entity, rather than requiring a non technical user to figure out the right order item type to use.Could be great to investigate this alternative UX.
- Merge request !315Draft: Issue #3403314: PoC of the new widget for order items → (Open) created by tbkot
Commerce can not be installed directly from project browser because IEF does not have a stable release.
IEF needs to be installed through composer and only then Commerce can be installed from project browser.- 🇮🇱Israel jsacksick
We are really close! Good job.
Wanted to include this one in the next release but it looks like it requires a bit more work:- We are currently assuming the order items can only reference product variations, breaking support for referencing other purchasable entity types.
- I'm thinking we could update the loop in
getListOfBundles()
to check the purchasable entity type ID? Like the following:
foreach ($order_item_types as $order_item_type) { // We currently only support adding variations from the admin. if ($access_handled->createAccess($order_item_type->id()) && $order_item_type->getPurchasableEntityTypeId() === 'commerce_product_variation') { $bundles[] = $order_item_type->id(); } }
The only problem is, on new installs, the purchasable entity type isn't set... (just tried).
- Since commerce_order doesn't depend on commerce_product, I'm suspecting the current code could break...
- It would be great if we could implement a fallback to the current behavior in case there are order item types referencing other purchasable entity types? The order item type selector... I'm just afraid not having this fallback means you cannot add order items from the admin? Unless we accept this limitation and in this case people would need to use the IEF widget?
Also, not 100% convinced we should force people to use the new widget by writing an update hook... But maybe...?
- 🇮🇱Israel jsacksick
Ok here is what I think we should do...
If there is only one purchasable entity type referenced (commerce_product_variation, or something else), and it is known, we can probably offer the autocompletion? I don't think we have to hardcode commerce_product_variation right? Probably makes the code a bit more complex, but it should be doable?
In case there are multiple purchasable entity types possible (probably 5% of the usecases), we should offer the current UX as a fallback... Thoughts?