There are some Views that render the purchased_entity:
order summary, cart form, cart block
However, an order item type might specify a NULL purchased entity type, meaning that order items of that type won’t have a purchased entity, in which case there’s nothing to render
If there’s nothing to render, the view should show the order item title
there’s no logic for that
We need to create a custom views field plugin for the purchased_entity field
that has a settings form for selecting the view mode
and in the main function renders the purchased entity if it exists, otherwise it falls back to the order item title
Comments
Comment #2
vasikePR available
https://github.com/drupalcommerce/commerce/pull/650
Is there's something else needed?
Comment #3
jasonsafro commentedWorks for me.
Comment #4
kingdutchAdding patch file (based on PR linked in #2 on the date of this comment) so I can reference it from composer files without the possibility of it changing due to new commits on the PR.
Also unassigning because it needs a Review :)
Comment #5
BD3 commentedThanks, the patch in #4 is working for me using some donations with a custom form.
Comment #6
Marko B commentedNot sure how this is suppose to work. I have order summary view where I would expect to have an extra item that is added in table, but I keep getting 2 rows as result and this item is ignored, although it should be 3 of them. So the patch doesn't seem to help here, maybe it does in some other scenario, seems that we should have more robust solution.
Comment #7
Marko B commentedFurther inspecting I see the problem comes from production variation relationship, If I just list order items, this item will be shown without a problem, but as other products have product variations I want to show their image in cart summary, with that this "donation" item is gone out of results.
Comment #8
cameron prince commentedRe-roll for commerce v2.16.0.
Comment #9
spokjeLet's see if this reroll against the latest 8.x-2.x branch gives some more green in TestBot-land.
Comment #10
mstiRerolling for dev.
Fixes deprecation https://api.drupal.org/api/drupal/core%21modules%21views%21src%21Plugin%...
Comment #11
robcarrThis seems to work for me. Rolled against Commerce 2.27
+1 for RTBC
Comment #12
mstiI am updating the patch because it was giving an error for commerce 2.30
before:
after:
Comment #13
cameron prince commentedRe-roll for 3.x.