1

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?

  1. I know the SKU.
  2. 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.

2

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

I believe you can do this just fine using feeds and commerce feeds. The sku is commonly used as the unique id.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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