WC_Order::set_payment_method PHP Method

set_payment_method() public method

Set the payment method.
public set_payment_method ( string $payment_method = '' )
$payment_method string Supports WC_Payment_Gateway for bw compatibility with < 2.7
    public function set_payment_method($payment_method = '')
    {
        if (is_object($payment_method)) {
            $this->set_payment_method($payment_method->id);
            $this->set_payment_method_title($payment_method->get_title());
        } elseif ('' === $payment_method) {
            $this->set_prop('payment_method', '');
            $this->set_prop('payment_method_title', '');
        } else {
            $this->set_prop('payment_method', $payment_method);
        }
    }

Usage Example

Beispiel #1
0
 /**
  * Test: get_payment_method
  */
 function test_get_payment_method()
 {
     $object = new WC_Order();
     $set_to = 'paypal';
     $object->set_payment_method($set_to);
     $this->assertEquals($set_to, $object->get_payment_method());
 }
All Usage Examples Of WC_Order::set_payment_method
WC_Order