2
Answers
Vote up!
0
Vote down!

Accessing Line Item Options/Attributes

Hi --

For each order, I need to create a node with the values of the product attributes. I can create the node using rules, but I can't seem to access the product attributes (i.e. size - small, med, large) in rules. So I am looking at writing a small module but I can't seem to figure out where the data is buried! I tried the API and I tried looking at the $order variable but I don't see it. Does anyone know how to access the line item SKU and attributes from a module?

Thanks so so so much --

Missy.

*** UPDATE:

In case anyone is looking for the same thing:

// get option array
$options=commerce_option_load_by_line_item($line_item->line_item_id);

Asked by: Missy Smith
on August 30, 2014

2 Answers

Vote up!
1
Vote down!

In case anyone else is looking, here is the easiest way to access the options:

$options=commerce_option_load_by_line_item($line_item->line_item_id);

Answer by: Missy Smith
Posted: Sep 1, 2014