Add payment method to create order request body data filter

This commit is contained in:
Emili Castells Guasch 2023-11-23 11:40:21 +01:00
parent d0e7200669
commit 687b56d8c0
4 changed files with 12 additions and 11 deletions

View file

@ -219,14 +219,11 @@ class OrderEndpoint {
if ( $payment_token ) {
$data['payment_source']['token'] = $payment_token->to_array();
}
if ( $payment_method ) {
$data['payment_method'] = $payment_method;
}
/**
* The filter can be used to modify the order creation request body data.
*/
$data = apply_filters( 'ppcp_create_order_request_body_data', $data );
$data = apply_filters( 'ppcp_create_order_request_body_data', $data, $payment_method );
$url = trailingslashit( $this->host ) . 'v2/checkout/orders';
$args = array(
'method' => 'POST',