Product type or sku in order description
-
Hi there
I am trying to add a filter to the order description so that I can identify in Stripe either a product name, SKU or type for coding. This is so that I can tell the difference between orders for subscription products and orders for regular products.I have this so far:
add_filter('wc_stripe_payment_intent_args', function($args, $order){ $args['description'] = sprintf('Order %s %s %s', $order->get_order_number(), $order->get_billing_last_name(), $order->get_items()); return $args; },10, 2);
But all it prints is the Order ID, Last Name and the word ‘Array’.
I’ve searched and know the $order param is a WC_Order class and that I should be able to get the product and get the sku.
For example I found this:
foreach ( $order->get_items() as $item_id => $item ) { $product_type = $item->get_type(); }
But can’t work out how to use it. Are you able to help?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Product type or sku in order description’ is closed to new replies.