ID, 'order_data', true) ); if (!isset($data['billing_first_name'])) $data['billing_first_name'] = ''; if (!isset($data['billing_last_name'])) $data['billing_last_name'] = ''; if (!isset($data['billing_company'])) $data['billing_company'] = ''; if (!isset($data['billing_address_1'])) $data['billing_address_1'] = ''; if (!isset($data['billing_address_2'])) $data['billing_address_2'] = ''; if (!isset($data['billing_city'])) $data['billing_city'] = ''; if (!isset($data['billing_postcode'])) $data['billing_postcode'] = ''; if (!isset($data['billing_country'])) $data['billing_country'] = ''; if (!isset($data['billing_state'])) $data['billing_state'] = ''; if (!isset($data['billing_email'])) $data['billing_email'] = ''; if (!isset($data['billing_phone'])) $data['billing_phone'] = ''; if (!isset($data['shipping_first_name'])) $data['shipping_first_name'] = ''; if (!isset($data['shipping_last_name'])) $data['shipping_last_name'] = ''; if (!isset($data['shipping_company'])) $data['shipping_company'] = ''; if (!isset($data['shipping_address_1'])) $data['shipping_address_1'] = ''; if (!isset($data['shipping_address_2'])) $data['shipping_address_2'] = ''; if (!isset($data['shipping_city'])) $data['shipping_city'] = ''; if (!isset($data['shipping_postcode'])) $data['shipping_postcode'] = ''; if (!isset($data['shipping_country'])) $data['shipping_country'] = ''; if (!isset($data['shipping_state'])) $data['shipping_state'] = ''; $data['customer_user'] = (int) get_post_meta($post->ID, 'customer_user', true); $order_status = wp_get_post_terms($post->ID, 'shop_order_status'); if ($order_status) : $order_status = current($order_status); $data['order_status'] = $order_status->slug; else : $data['order_status'] = 'pending'; endif; if (!isset($post->post_title) || empty($post->post_title)) : $order_title = 'Order'; else : $order_title = $post->post_title; endif; ?>

'billing_first_name', 'label' => 'First Name:' ); echo '

'; // Last Name $field = array( 'id' => 'billing_last_name', 'label' => 'Last Name:' ); echo '

'; // Company $field = array( 'id' => 'billing_company', 'label' => 'Company:' ); echo '

'; // Address 1 $field = array( 'id' => 'billing_address_1', 'label' => 'Address 1:' ); echo '

'; // Address 2 $field = array( 'id' => 'billing_address_2', 'label' => 'Address 2:' ); echo '

'; // City $field = array( 'id' => 'billing_city', 'label' => 'City:' ); echo '

'; // Postcode $field = array( 'id' => 'billing_postcode', 'label' => 'Postcode:' ); echo '

'; // Country $field = array( 'id' => 'billing_country', 'label' => 'Country:' ); echo '

'; // State $field = array( 'id' => 'billing_state', 'label' => 'State/County:' ); echo '

'; // Email $field = array( 'id' => 'billing_email', 'label' => 'Email Address:' ); echo '

'; // Tel $field = array( 'id' => 'billing_phone', 'label' => 'Tel:' ); echo '

'; ?>

'shipping_first_name', 'label' => 'First Name:' ); echo '

'; // Last Name $field = array( 'id' => 'shipping_last_name', 'label' => 'Last Name:' ); echo '

'; // Company $field = array( 'id' => 'shipping_company', 'label' => 'Company:' ); echo '

'; // Address 1 $field = array( 'id' => 'shipping_address_1', 'label' => 'Address 1:' ); echo '

'; // Address 2 $field = array( 'id' => 'shipping_address_2', 'label' => 'Address 2:' ); echo '

'; // City $field = array( 'id' => 'shipping_city', 'label' => 'City:' ); echo '

'; // Postcode $field = array( 'id' => 'shipping_postcode', 'label' => 'Postcode:' ); echo '

'; // Country $field = array( 'id' => 'shipping_country', 'label' => 'Country:' ); echo '

'; // State $field = array( 'id' => 'shipping_state', 'label' => 'State/County:' ); echo '

'; ?>
ID, 'order_items', true) ); ?>
0 && isset($order_items[0]['id'])) foreach ($order_items as $item) : if (isset($item['variation_id']) && $item['variation_id'] > 0) : $_product = &new woocommerce_product_variation( $item['variation_id'] ); else : $_product = &new woocommerce_product( $item['id'] ); endif; ?>
sku) echo $_product->sku; else echo '-'; ?> variation_data)) : echo woocommerce_get_formatted_variation( $_product->variation_data, true ); else : echo '-'; endif; ?>

ID, 'order_data', true) ); if (!isset($data['shipping_method'])) $data['shipping_method'] = ''; if (!isset($data['payment_method'])) $data['payment_method'] = ''; if (!isset($data['order_subtotal'])) $data['order_subtotal'] = ''; if (!isset($data['order_shipping'])) $data['order_shipping'] = ''; if (!isset($data['order_discount'])) $data['order_discount'] = ''; if (!isset($data['order_tax'])) $data['order_tax'] = ''; if (!isset($data['order_total'])) $data['order_total'] = ''; if (!isset($data['order_shipping_tax'])) $data['order_shipping_tax'] = ''; ?>
update_status( $_POST['order_status'] ); // Order items $order_items = array(); if (isset($_POST['item_id'])) : $item_id = $_POST['item_id']; $item_variation= $_POST['item_variation']; $item_name = $_POST['item_name']; $item_quantity = $_POST['item_quantity']; $item_cost = $_POST['item_cost']; $item_tax_rate = $_POST['item_tax_rate']; for ($i=0; $i htmlspecialchars(stripslashes($item_id[$i])), 'variation_id' => (int) $item_variation[$i], 'name' => htmlspecialchars(stripslashes($item_name[$i])), 'qty' => (int) $item_quantity[$i], 'cost' => number_format(woocommerce_clean($item_cost[$i]), 2, '.', ''), 'taxrate' => number_format(woocommerce_clean($item_tax_rate[$i]), 4, '.', ''), )); endfor; endif; // Save update_post_meta( $post_id, 'order_data', $data ); update_post_meta( $post_id, 'order_items', $order_items ); // Handle button actions if (isset($_POST['reduce_stock']) && $_POST['reduce_stock'] && sizeof($order_items)>0) : $order->add_order_note( __('Manually reducing stock.', 'woothemes') ); foreach ($order_items as $order_item) : $_product = $order->get_product_from_item( $order_item ); if ($_product->exists) : if ($_product->managing_stock()) : $old_stock = $_product->stock; $new_quantity = $_product->reduce_stock( $order_item['qty'] ); $order->add_order_note( sprintf( __('Item #%s stock reduced from %s to %s.', 'woothemes'), $order_item['id'], $old_stock, $new_quantity) ); if ($new_quantity<0) : do_action('woocommerce_product_on_backorder_notification', $order_item['id'], $values['quantity']); endif; // stock status notifications if (get_option('woocommerce_notify_no_stock_amount') && get_option('woocommerce_notify_no_stock_amount')>=$new_quantity) : do_action('woocommerce_no_stock_notification', $order_item['id']); elseif (get_option('woocommerce_notify_low_stock_amount') && get_option('woocommerce_notify_low_stock_amount')>=$new_quantity) : do_action('woocommerce_low_stock_notification', $order_item['id']); endif; endif; else : $order->add_order_note( sprintf( __('Item %s %s not found, skipping.', 'woothemes'), $order_item['id'], $order_item['name'] ) ); endif; endforeach; $order->add_order_note( __('Manual stock reduction complete.', 'woothemes') ); elseif (isset($_POST['restore_stock']) && $_POST['restore_stock'] && sizeof($order_items)>0) : $order->add_order_note( __('Manually restoring stock.', 'woothemes') ); foreach ($order_items as $order_item) : $_product = $order->get_product_from_item( $order_item ); if ($_product->exists) : if ($_product->managing_stock()) : $old_stock = $_product->stock; $new_quantity = $_product->increase_stock( $order_item['qty'] ); $order->add_order_note( sprintf( __('Item #%s stock increased from %s to %s.', 'woothemes'), $order_item['id'], $old_stock, $new_quantity) ); endif; else : $order->add_order_note( sprintf( __('Item %s %s not found, skipping.', 'woothemes'), $order_item['id'], $order_item['name'] ) ); endif; endforeach; $order->add_order_note( __('Manual stock restore complete.', 'woothemes') ); elseif (isset($_POST['invoice']) && $_POST['invoice']) : // Mail link to customer woocommerce_pay_for_order_customer_notification( $order->id ); endif; // Error Handling if (sizeof($woocommerce_errors)>0) update_option('woocommerce_errors', $woocommerce_errors); }