/**
  * Update data in the database.
  * @since 2.7.0
  */
 public function update()
 {
     parent::update();
     // Store additonal order data
     $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());
 }
 /**
  * Update data in the database.
  * @since 2.7.0
  */
 public function update()
 {
     // Store additonal order data
     $this->update_post_meta('_order_key', $this->get_order_key());
     $this->update_post_meta('_customer_user', $this->get_customer_id());
     $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());
     $customer_changed = $this->update_post_meta('_customer_user', $this->get_customer_id());
     // Update parent
     parent::update();
     // If customer changed, update any downloadable permissions
     if ($customer_changed) {
         $wpdb->update($wpdb->prefix . "woocommerce_downloadable_product_permissions", array('user_id' => $this->get_customer_id(), 'user_email' => $this->get_billing_email()), array('order_id' => $this->get_id()), array('%d', '%s'), array('%d'));
     }
     // Handle status change
     $this->status_transition();
 }