This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'rest_api_init', 'custom_api_endpoints' ); | |
function custom_api_endpoints() { | |
/** | |
* Handle Payment Method request. | |
*/ | |
register_rest_route( 'wc/v2', 'payment', array( | |
'methods' => 'POST', | |
'callback' => 'custom_payment_endpoint_handler', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'rest_api_init', 'custom_api_endpoints' ); | |
function custom_api_endpoints() { | |
/** | |
* Handle Get Payment Method request. | |
*/ | |
register_rest_route( 'wc/v2', 'get_payment_methods', array( | |
'methods' => 'POST', | |
'callback' => 'custom_get_payment_methods_endpoint_handler', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//removes extra keys from the wc orders rest api | |
function change_shop_order_response( $response, $object, $request ) { | |
$response_data = $response->data; | |
$remove_keys = array('version','currency','customer_ip_address','customer_user_agent',''); | |
$filtered_res = array_diff_key( $response_data, array_flip( $remove_keys ) ); | |
$response->data = $filtered_res; | |
return $response; | |
} |