Access fields with wc order object
-
How do I access this data programmatically with the order object from wc_get_order( $order_id ); especially when getting the order items as shown below?
function send_gift_card_coupon( $order_id ) { // Getting an instance of the order object $order = wc_get_order( $order_id ); $start = 0; foreach ( $order->get_items() as $item_id => $item ) { // HOW DO I ACCESS THE FIELDS HERE PLEASE //???????????????? $quantity = $item->get_quantity(); $total_amount = $order->get_total(); $user_id = $order->get_user_id(); $user = get_userdata( $user_id ); $email = $user->user_email; while( $start < $quantity ){ $this->wpccb_auto_create_coupon_for_gift_card( $this->wpccb_generate_gift_card_coupon_code(), $email, $total_amount, $order_id ); $start++; } } }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Access fields with wc order object’ is closed to new replies.