18th Jan 2021
Framework / CMS
WooCommerce [Version: Since 3.0.0]
Sets the payment method for a WooCommerce order.
- payment_method (string) (Optional) (Default = none): The payment method.
payment_method() supports WC_Payment_Gateway for backward compatibility with versions before 3.0.
Examples of set_payment_method()
$user_id = get_current_user_id();
$args = array(
'customer_id' => $user_id
);$gateways = WC()->payment_gateways->payment_gateways(); $new_order->set_payment_method( $gateways['bacs'] );
Used In Projects
Was This Helpful?
If this post has helped you, please let me know. Your feedback will be highly appreciated and will help me build better content.