On site interaction using any API methods, the system reply through an JSON encoded message including a status code to makes interpretation easier.
Success
- s100
Licence Key Successfully activated for ‘domain’ - s101
Licence Key Successfully activated for ‘domain’ – *first pass - s201
Licence Key Successfully Unassigned - s203
Licence Key Is Unassigned - s205
Licence key Is Active and Valid for Domain ( when assign_domain_to_key_on_status_check option active ) - s215
Licence key Is Active and Valid for Domain - s401
*a full response with code metadata on calling plugin_update or theme_update methods - s402
*a full response with code metadata on calling plugin_information method - s403
*a full response with code metadata on calling code_information method - s610
*Licence Key Successfully Deleted
Error
- e001
Invalid provided data - e002
Invalid licence key - e003
Order does not exist anymore - e004
Order status not allowed - e110
Invalid licence key or licence not active for domain - e111
Invalid Data - e112
You had reached the maximum number of domains for this key - e204
Licence key not active for current domain - e301
Licence Key does not match this product - e312
Licence is not Active, current status is ‘STATUS’ - e419
Invalid Product Unique ID
Category: News
I am trying to change message for e112 using WOOSL/API_call/response but it’s not working. I also tried with WOOSL/API_call/response_block but there was no change. The cache module in Woocommerce Settings is also off and there’s no any other caching plugin.Please check this code and let me know if I am doing anything wrong here.
add_filter(‘WOOSL/API_call/response’, ‘woosl_api_change_limit_message’, 10, 3);
function woosl_api_change_limit_message( $response, $args, $api_object )
{
//check if the API call method is not activate
if ( $args[‘woo_sl_action’] != ‘activate’ )
return $response;
//fetch the last response in the list
reset ( $response );
$response = current( $response );
//check for specific status, if operation was sucess
if ( ! in_array( ‘e112’, $response[‘status_code’]) )
return $response;
$response[‘message’] = ‘Limit reached’;
return $response;
}
I also tried only returning $response[‘message’] without any if conditions but still no any change.
Am I doing something wrong or is there other way to update response message?
Thank you.
Hi,
The filter WOOSL/API_call/response should work just fine, you have an example at https://wpsoftwarelicense.com/documentation/wooslapi_callresponse/
Adjust your code to the following which should work just fine:
Thanks
Hi,
If still can’t figure it out, consider using the Contact form.
Thanks