-
-
Save aayushdrolia/6b3e2fe078272146c05c57c687413a0a to your computer and use it in GitHub Desktop.
Get SKU from products in an order
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 = 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