I am trying to create an application that tells me my trade order, order items and quantity,
I'm 90% there
function custom_woocommerce_complete_order_sms( $order_id ) { global $woocommerce; if ( !$order_id ) return; $order = new WC_Order( $order_id ); $product_list = ''; $order_item = $order->get_items(); foreach( $order_item as $product ) { $prodct_name[] = $product['name']; } $product_list = implode( ',\n', $prodct_name ); require "twilio-php-master/Services/Twilio.php"; $AccountSid = "xxxxxxxxx"; $AuthToken = "xxxxxxxxx"; $client = new Services_Twilio($AccountSid, $AuthToken); $people = array( "xxxxxxxxxx" => "Me", ); foreach ($people as $number => $name) { $sms = $client->account->messages->sendMessage( "+44xxxxxxxxxx",
My problem is that I do not know how to get the Number element, for example, my text looks like a list, paragraph 1, paragraph 2, paragraph 3, I want him to say paragraph 1 x1, paragraph 2 x2, item3 x3
I tried to look into the email php file in the abstract woo commerce folder to see how they arrive when they send the quantity in emails, but lost a little
also in WC_Abstract_Order class, the only thing I could find was get_item_total , which returns the total number of all elements
php woocommerce
user2389087
source share