To automatically delete the product displays when a product is deleted, is a feature of the module Auto Product Display, but I don't need that module.

Preferably using the Rules module, I would like to accomplish the same. An issue in drupal.org is present, but currently open.

I'm trying to fetch the referencing product displays:

Trigger: After deleting a Commerce Product

  • Fetch entity by property
  • Entity is of type: node
  • The property by which the entity is to be selected: product (the product reference field)
  • The property value of the entity to be fetched: ?? (The node ID of the product is not available to select)

How to get the node ID's of all product displays referencing the product?

  • Which is the Event you are using to trigger the Rules? Commented May 24, 2016 at 17:28

1 Answer 1


1) You need the commerce product id (which is the one of the commerce product that has been deleted) and not the nid because of the reference you are using. If this parameter is not available you must bring it into scope using a proper validation.

Notice that after deleting the commerce product there is no product id so no products are referencing it. The correct trigger should be "before deleting commerce product" but does not exist by default.

Also, how do you handle a Product display (node) with multiple product variations? Should this node be deleted? There should be an additional condition to check if there are other variations for the same product display. Except if you have a 1 to 1 reference.

2) Another option should be to do the opposite which is to fetch all the nodes (Product displays) that have an empty commerce product reference. This is easier to create.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.