Skip to content

Instantly share code, notes, and snippets.

@maxrice
Created December 11, 2013 20:55
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save maxrice/7918315 to your computer and use it in GitHub Desktop.
Save maxrice/7918315 to your computer and use it in GitHub Desktop.
Get SKU from products in an order
<?php
$order = new WC_Order( $order_id );
foreach ( $order->get_items() as $item_key => $item ) {
$product = $order->get_product_from_item( $item );
$sku = $product->get_sku();
// print_r( $item );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment