ID; add_action('admin_footer', 'woocommerce_meta_scripts'); wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' ); // Custom user $customer_user = (int) get_post_meta($post->ID, '_customer_user', true); // Order status $order_status = wp_get_post_terms($post->ID, 'shop_order_status'); if ($order_status) : $order_status = current($order_status); $order_status = $order_status->slug; else : $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', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_billing_last_name', 'label' => __('Last Name', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_billing_company', 'label' => __('Company', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_billing_address_1', 'label' => __('Address 1', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_billing_address_2', 'label' => __('Address 2', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_billing_city', 'label' => __('City', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_billing_postcode', 'label' => __('Postcode', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_billing_country', 'label' => __('Country', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_billing_state', 'label' => __('State/County', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_billing_email', 'label' => __('Email Address', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_billing_phone', 'label' => __('Tel', 'woothemes') ) ); ?>

'_shipping_first_name', 'label' => __('First Name', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_shipping_last_name', 'label' => __('Last Name', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_shipping_company', 'label' => __('Company', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_shipping_address_1', 'label' => __('Address 1', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_shipping_address_2', 'label' => __('Address 2', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_shipping_city', 'label' => __('City', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_shipping_postcode', 'label' => __('Postcode', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_shipping_country', 'label' => __('Country', 'woothemes') ) ); woocommerce_wp_text_input( array( 'id' => '_shipping_state', 'label' => __('State/County', 'woothemes') ) ); ?>
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; ?>
variation_data)) : echo '
' . woocommerce_get_formatted_variation( $_product->variation_data, true ); endif; ?>
$value) : echo ''; endforeach; ?>

ID ); ?>
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']; $item_meta_names = $_POST['meta_name']; $item_meta_values = $_POST['meta_value']; 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, '.', ''), 'item_meta' => $item_meta )); endfor; endif; 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); }