Merge pull request #22721 from woocommerce/fix/webhooks-payload

Load REST API endpoints before generate webhook payload
This commit is contained in:
Mike Jolley 2019-02-13 13:59:55 +00:00 committed by GitHub
commit 1451f6101d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -290,6 +290,11 @@ class WC_Webhook extends WC_Legacy_Webhook {
$rest_api_versions = wc_get_webhook_rest_api_versions();
$version_suffix = end( $rest_api_versions ) !== $this->get_api_version() ? strtoupper( str_replace( 'wp_api', '', $this->get_api_version() ) ) : '';
// Load REST API endpoints to generate payload.
if ( ! did_action( 'rest_api_init' ) ) {
WC()->api->rest_api_includes();
}
switch ( $resource ) {
case 'coupon':
case 'customer':