1
Answers
Vote up!
0
Vote down!

How to get product SKU from order in rules?

When a order is paid I successfully create a custom content type the buyer has to fill out. This newly created content needs a reference to the bought product.

I try doing so using a "set a data value" action but can't figure out how to get the product reference from the commerce-order. Data selector shows "commerce-order:commerce-line-items:" but no reference to the product.

Seems quite basic but I couldn't find any documentation on that.

Asked by: gerald
on June 27, 2013

1 Answer

Vote up!
0
Vote down!

Before you can have a product in the actions you must make it available. You do that by checking for a product's field in the conditions via data comparison.

Answer by: l0calh0rst
Posted: Jun 28, 2013

Comments

How do you check for a products field using data comparison? I can't find a way to do this - the product doesn't show in the data selector at all under order or line items.

- pearlbear on October 17, 2013

I answered my own question. Use "Entity Has Field", choose "commerce-order:commerce-line-items:0" and the field "commerce-product". The fields in product (like SKU) are now available to any actions.

- pearlbear on October 23, 2013