Detailed in https://www.drupal.org/project/commerce/issues/2937918#comment-12543714
If commerce don't think it's a bug, we should disable the selection of "Allow users to add existing variations."

Comments

caseylau created an issue. See original summary.

lawxen’s picture

Status: Active » Needs review
StatusFileSize
new0 bytes

Status: Needs review » Needs work

The last submitted patch, 2: 2956095-2.patch, failed testing. View results

lawxen’s picture

Status: Needs work » Needs review
StatusFileSize
new836 bytes
lawxen’s picture

Comment in https://www.drupal.org/project/commerce/issues/2937918#comment-12545293

I think the following logic maybe right:

  1. Delete a “related existing variation”, commerce won’t delete the origin product variation.
  2. Delete the origin product, the variation must be deleted.

But the origin variation and the “related existing variation” has no difference, entity_reference can't support above vision, So

  1. This issue's patch can't be accepted
  2. Commerce should forbid the "Allow users to add existing variations" choice in issue:https://www.drupal.org/project/commerce/issues/2956095
bojanz’s picture

Status: Needs review » Needs work

I approve of the general idea.

Let's implement hook_form_FORM_ID_alter() instead, so that we can remove the $form_id comparison from the IF. Simpler that way, and matches what we do in other form alters.

lawxen’s picture

Status: Needs work » Needs review
StatusFileSize
new991 bytes
new1.26 KB

@bojanz
Thanks for the advice, I have changed to hook_form_FORM_ID_alter() and hide "Allow users to add existing variations" directly, not disable it.

bojanz’s picture

Status: Needs review » Fixed

Tweaked and committed, thanks!

  • bojanz committed 20b88dd on 8.x-2.x authored by caseylau
    Issue #2956095 by caseylau: Disable "Allow users to add existing...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.