Created
January 20, 2015 13:53
-
-
Save zenith6/8afd1afb901d37fad41a to your computer and use it in GitHub Desktop.
Drupal Commerce 注文データから項目を取得する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $order = /* order object */; | |
| $wrapper = entity_metadata_wrapper('commerce_order', $order); | |
| $items = []; | |
| foreach ($wrapper->commerce_line_items as $line_item) { | |
| $items[] = [ | |
| 'type' => $line_item->type->value(), # Product type machine name | |
| 'line_item_label' => $line_item->line_item_label->value(), # SKU | |
| 'quantity' => $line_item->quantity->value(), # Quantity | |
| ]; | |
| } | |
| // dd($items); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment