WooCommerce 3.0+. you can get the order items of an order by $order = wc_get_order( $order_id ); $items = $order->get_items();. then if you loop through the ...
Or maybe the order ID, customer ID, billing info, payment method, total
In this case, you have to find a way to “get the $product object from $product_id” – you find this example below. Other examples might be the order or the cart ...
This code is outdated for WooCommerce version 3+. You should use instead: add_action( 'woocommerce_thankyou' ...
It has to be added to functions.php in your theme, then called in the Content Template with the ShortCode [get_user_who_bought_the_product], ...
If you use the get_id() method, you get your item ID which is 15 in your code. Get the product ID: The correct WC_Order_Item_Product method ...
The [products] shortcode allows you to display products by post ID, SKU, categories, attributes ...
... subscriptions…) $user_id = $order->get_user_id(); // Get the costumer ID $user ... Get data from The WC_product object using methods (examples) $product ...
Note: Virtual products don't require shipping — an order with virtual products
Get order ID this meta belongs to. get_product() : WC_Product |bool: Get the associated product. get_product_id() : int: Get product ID.