The WooCommerce order class handles order data.
Author: WooThemes
 /**
  * Set order status.
  * @since 2.7.0
  * @param string $new_status Status to change the order to. No internal wc- prefix is required.
  * @param string $note (default: '') Optional note to add.
  * @param bool $manual_update is this a manual order status change?
  * @param array details of change
  */
 public function set_status($new_status, $note = '', $manual_update = false)
 {
     $result = parent::set_status($new_status);
     if (!empty($result['from']) && $result['from'] !== $result['to']) {
         $this->_status_transition = array('from' => !empty($this->_status_transition['from']) ? $this->_status_transition['from'] : $result['from'], 'to' => $result['to'], 'note' => $note, 'manual' => (bool) $manual_update);
         if ('pending' === $result['from'] && !$manual_update) {
             $this->set_date_paid(current_time('timestamp'));
         }
         if ('completed' === $result['to']) {
             $this->set_date_completed(current_time('timestamp'));
         }
     }
     return $result;
 }
 /**
  * Magic __get method for backwards compatibility.
  *
  * @param string $key
  * @return mixed
  */
 public function __get($key)
 {
     wc_doing_it_wrong($key, 'Refund properties should not be accessed directly.', '2.7');
     /**
      * Maps legacy vars to new getters.
      */
     if ('reason' === $key) {
         return $this->get_reason();
     } elseif ('refund_amount' === $key) {
         return $this->get_amount();
     }
     return parent::__get($key);
 }
Beispiel #3
0
 public function is_editable()
 {
     return parent::is_editable();
     // TODO: Change the autogenerated stub
 }
Beispiel #4
0
 /**
  * Initialize the order refund.
  *
  * @param int|WC_Order $order
  */
 public function __construct($order)
 {
     $this->order_type = 'simple';
     parent::__construct($order);
 }
Beispiel #5
0
 function change_cancel_order_url_try( $redirect = '' ) {

    // Get cancel endpoint
    
    $cancel_endpoint = WC_Abstract_Order::get_cancel_endpoint();

    return apply_filters( 'woocommerce_get_cancel_order_url_raw', add_query_arg( array(
      'cancel_order' => 'true',
      'order'        => $this->order_key,
      'order_id'     => $this->id,
      'redirect'     => $redirect,
      '_wpnonce'     => wp_create_nonce( 'woocommerce-cancel_order' )
    ), $cancel_endpoint ) );
  }