Wpd Alpha Insights Skip Refunds Without Parent

Alpha Insights Documentation

Docs Navigation

Filter: wpd_alpha_insights_skip_refunds_without_parent

Control whether refunds without a valid parent order are excluded from the refunds data source.

Description

Orphaned or broken refund records (no parent order or invalid parent) can be skipped when building refunds data. By default the filter returns true, so refunds without a valid parent are skipped. Return false to include them (e.g. for debugging or if your data has valid refunds without a loadable parent).

Location

File: includes/classes/data-sources/WPDAI_Refunds_Internal_Data_Source.php

Context: When processing each refund; if true and the parent order is missing, the refund is skipped.

Parameters

Parameter Type Description
$skip_refunds_without_parent bool Whether to skip refunds that have no valid parent order (default true)
$refund WC_Order_Refund The current refund order object
$data_warehouse WPDAI_Data_Warehouse The data warehouse instance

Return

Type: bool

True to skip refunds without a valid parent; false to include them.

Example Usage

Include orphan refunds for auditing

add_filter( 'wpd_alpha_insights_skip_refunds_without_parent', '__return_false' );

Skip only when not debugging

add_filter( 'wpd_alpha_insights_skip_refunds_without_parent', 'skip_orphan_refunds_unless_debug', 10, 3 );
function skip_orphan_refunds_unless_debug( $skip, $refund, $data_warehouse ) {
    if ( defined( 'WP_DEBUG' ) && WP_DEBUG && current_user_can( 'manage_options' ) ) {
        return false; // Include orphans when debugging
    }
    return $skip;
}

Related

Got A Question?

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Alpha Insights

Alpha Insights

The World's Most Advanced WooCommerce Profit Reporting Engine

5/5 – Trustpilot

Alpha Insights