/**
  * Insert data into the database.
  * @since 2.7.0
  */
 public function create()
 {
     parent::create();
     // Store additonal order data
     if ($this->get_id()) {
         $this->update_post_meta('_refund_amount', $this->get_amount());
         $this->update_post_meta('_refunded_by', $this->get_refunded_by());
         $this->update_post_meta('_refund_reason', $this->get_reason());
     }
 }
 /**
  * Insert data into the database.
  * @since 2.7.0
  */
 public function create()
 {
     parent::create();
     // Store additonal order data
     if ($this->get_id()) {
         $this->set_order_key('wc_' . apply_filters('woocommerce_generate_order_key', uniqid('order_')));
         $this->update_post_meta('_customer_user', $this->get_customer_id());
         $this->update_post_meta('_order_key', $this->get_order_key());
         $this->update_post_meta('_billing_first_name', $this->get_billing_first_name());
         $this->update_post_meta('_billing_last_name', $this->get_billing_last_name());
         $this->update_post_meta('_billing_company', $this->get_billing_company());
         $this->update_post_meta('_billing_address_1', $this->get_billing_address_1());
         $this->update_post_meta('_billing_address_2', $this->get_billing_address_2());
         $this->update_post_meta('_billing_city', $this->get_billing_city());
         $this->update_post_meta('_billing_state', $this->get_billing_state());
         $this->update_post_meta('_billing_postcode', $this->get_billing_postcode());
         $this->update_post_meta('_billing_country', $this->get_billing_country());
         $this->update_post_meta('_billing_email', $this->get_billing_email());
         $this->update_post_meta('_billing_phone', $this->get_billing_phone());
         $this->update_post_meta('_shipping_first_name', $this->get_shipping_first_name());
         $this->update_post_meta('_shipping_last_name', $this->get_shipping_last_name());
         $this->update_post_meta('_shipping_company', $this->get_shipping_company());
         $this->update_post_meta('_shipping_address_1', $this->get_shipping_address_1());
         $this->update_post_meta('_shipping_address_2', $this->get_shipping_address_2());
         $this->update_post_meta('_shipping_city', $this->get_shipping_city());
         $this->update_post_meta('_shipping_state', $this->get_shipping_state());
         $this->update_post_meta('_shipping_postcode', $this->get_shipping_postcode());
         $this->update_post_meta('_shipping_country', $this->get_shipping_country());
         $this->update_post_meta('_payment_method', $this->get_payment_method());
         $this->update_post_meta('_payment_method_title', $this->get_payment_method_title());
         $this->update_post_meta('_transaction_id', $this->get_transaction_id());
         $this->update_post_meta('_customer_ip_address', $this->get_customer_ip_address());
         $this->update_post_meta('_customer_user_agent', $this->get_customer_user_agent());
         $this->update_post_meta('_created_via', $this->get_created_via());
         $this->update_post_meta('_customer_note', $this->get_customer_note());
         $this->update_post_meta('_date_completed', $this->get_date_completed());
         $this->update_post_meta('_date_paid', $this->get_date_paid());
         $this->update_post_meta('_cart_hash', $this->get_cart_hash());
         do_action('woocommerce_new_order', $this->get_id());
     }
 }