This issue does require the patch from this issue being applied.
Steps to reproduce
- Create a simple product type see commerce documentation
- At
admin/commerce/config/product-types/simple_product/edit/form-display, set the widget for the "Variations" field to "Single variation (Product information)" - Add a product entity reference field to any content type, referencing your simple product type. Set the widget to "Inline entity form - Complex". At
admin/structure/types/manage/MY-CONTENT-TYPE/form-displayI am checking both Allow users to add new product entities & Allow users to add existing product entities
Problem/Motivation
When editing existing products and product information in the IEF and clicking Update Product, changes to the product are saved, but changes to the product variation are not saved.
If you take the IEF out of the equation by navigate to the product itself product/*/edit, you can modify the nested variation and the Save button updates the variation as it should.
If you edit and update the product variation in the IEF widget on the node by leaving the widget open and saving the node, it updates the variation as it should.
Proposed resolution
Is there a way we can leverage the logic behind the Save button from the product/*/edit page inside the Complex IEF instead of the logic behind the Update Product button?
Comments
Comment #2
tonytheferg commentedComment #3
mglamanThis is actually a conflict with IEF + the InlineForm for single variations.
It could also just be a bug with IEF and needing to not click "Update" and closing the IEF form.
Comment #4
tonytheferg commentedTested setting the nested variation form display to complex IEF and it updates correctly, so @mglaman is right on about the InlineForm.
A temporary workaround for this as of now is to either:
Comment #5
adamps commentedIn a duplicate issue, bojanz commented:
Since Drupal core doesn't support #element_submit, we had to implement our own version of it, once for each module (Commerce, IEF).
The versions in Commerce and IEF are not compatible, and don't fire at the same time. Someone could look into porting the #commerce_element_submit approach to IEF, since the Commerce approach is newer.
#3051990: Refactor IEF based on Commerce InlineForm API improvements as a 4.x major version was supposed to rewrite IEF to do all of that, but that effort stalled. Still, reworking just element_submit is probably doable, so I encourage people to try.
Comment #6
tonytheferg commentedBetter steps and description
Comment #7
adamps commentedThanks. Also should be a feature I think.
Comment #8
geek-merlinAlso there are several issues in IEF where nested forms don't work reliably.
(I suppose that the underlying reason is stated in #5)
https://www.drupal.org/project/issues/inline_entity_form?text=nested
Comment #9
tonytheferg commentedPatch from https://www.drupal.org/project/commerce/issues/3262327 seems to work.