WOOSL/API_call/early_response

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPrint this page

Type
Filter

Arguments
(array) $response
(array) $args
(class) $api_object

Description
Allows filtering the API response by adding a custom response item on top of everything else.

Observation
The cache module need to be off for the filter to trigger.

Example of usage
Return additional response with a timestamp call, on top of the other API messages.

    add_filter( 'WOOSL/API_call/early_response', 'WOOSL_API_call_early_response', 10, 3 );
    function WOOSL_API_call_early_response ( $response, $args, $object )
        {
            
            $response[] =   array ( 
                                    'status'    =>  'success',
                                    'timestamp' =>  time(),
                                    'message'   =>  'API call time'
                                        );
               
            return $response;   
        }

By woocommerce-sl, posted on January 27, 2021

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments