How do I update commerce product display nodes based on SKU (of the referenced product)? I would like to update the product display nodes with taxonomy terms based on the SKU of the referenced product of each node. Is that possible, programmatically?


I know the SKU.
I need to find the product by the SKU of a product display.
1.I update the taxonomy term of the product display accordingly.


I tried to use EntityFieldQuery without success.

If someone could possibly give me an idea on the best approach to do this in DrupalCommerce, or provide a link to the documentation I have missed, it is greatly appreciated. I have lost a day or two googling the wrong questions, apparently.
Although an old thread, for the benefit of others looking, this could be done easily using views_bulk_operations (VBO). No coding required.


Install VBO.
Create a View of product display nodes.
Add a relationship to commerce product.
Add a batch update operations field to the View.
Enable the "Modify entity fields" option in the VBO field settings.
Add an exposed filter for the product SKU
Save
Use the batch update operation to check and set the relevant taxonomy term reference field.