WC_Order::save PHP Method

save() public method

Save data to the database.
Since: 2.7.0
public save ( ) : integer
return integer order ID
    public function save()
    {
        $this->maybe_set_user_billing_email();
        if ($this->data_store) {
            if ($this->get_id()) {
                $this->data_store->update($this);
            } else {
                $this->data_store->create($this);
            }
        }
        $this->save_items();
        $this->status_transition();
        return $this->get_id();
    }

Usage Example

Beispiel #1
0
 /**
  * Test: get_remaining_refund_amount
  */
 function test_get_remaining_refund_amount()
 {
     $object = new WC_Order();
     $object->set_total(400);
     $id = $object->save();
     wc_create_refund(array('order_id' => $id, 'amount' => '100', 'line_items' => array()));
     $this->assertEquals(300, $object->get_remaining_refund_amount());
 }
All Usage Examples Of WC_Order::save
WC_Order