Warning: This method has been deprecated. Webhooks deliveries logs now uses logging system instead.

WC_API_Webhooks::get_webhook_delivery( string $webhook_id, string $id, string|null $fields = null )

Get the delivery log for the given webhook ID and delivery ID


Description Description


Parameters Parameters

$webhook_id

(Required) webhook ID

$id

(Required) delivery log ID

$fields

(Optional) fields to limit response to

Default value: null


Top ↑

Return Return

(array|WP_Error)


Top ↑

Source Source

File: includes/legacy/api/v2/class-wc-api-webhooks.php

429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
public function get_webhook_delivery( $webhook_id, $id, $fields = null ) {
    try {
        // Validate webhook ID
        $webhook_id = $this->validate_request( $webhook_id, 'shop_webhook', 'read' );
 
        if ( is_wp_error( $webhook_id ) ) {
            return $webhook_id;
        }
 
        $id = absint( $id );
 
        if ( empty( $id ) ) {
            throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_delivery_id', __( 'Invalid webhook delivery ID.', 'woocommerce' ), 404 );
        }
 
        $webhook = new WC_Webhook( $webhook_id );
 
        $log = 0;
 
        if ( ! $log ) {
            throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_delivery_id', __( 'Invalid webhook delivery.', 'woocommerce' ), 400 );
        }
 
        return array( 'webhook_delivery' => apply_filters( 'woocommerce_api_webhook_delivery_response', array(), $id, $fields, $log, $webhook_id, $this ) );
    } catch ( WC_API_Exception $e ) {
        return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
    }
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.3.0 Webhooks deliveries logs now uses logging system.
2.2 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.