This issue does require the patch from this issue being applied.

Steps to reproduce

  1. Create a simple product type see commerce documentation
  2. At admin/commerce/config/product-types/simple_product/edit/form-display, set the widget for the "Variations" field to "Single variation (Product information)"
  3. 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-display I 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

ToneLoc created an issue. See original summary.

tonytheferg’s picture

Issue summary: View changes
mglaman’s picture

Project: Inline Entity Form » Commerce Core
Version: 8.x-1.0-rc7 » 8.x-2.x-dev
Component: Code » Product

This 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.

tonytheferg’s picture

Tested 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:

  1. use the Single Variation (Product Information) widget and save the node while the IEF is open,
  2. use the IEF widget form display for the variation.
adamps’s picture

In 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.

tonytheferg’s picture

Issue summary: View changes

Better steps and description

adamps’s picture

Category: Support request » Feature request

Thanks. Also should be a feature I think.

geek-merlin’s picture

Also 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

tonytheferg’s picture