Skip to main content

benecaster_price_change_applied

Action Premium

Fires once no subscriber on the change is still pending — every row has ended up applied, skipped or failed. Covers both tier and buy-up price changes.

Parameters

Name Type Default Description
$change_id int — The completed change's ID.
$change array — The change row.
$rows array — Every subscriber row in its final state: `applied`; `skipped` with `skip_reason` of `cancelled`, `tier_changed`, `billing_exception` or `not_on_price`; or `failed` with `message`.

Examples

Alert an ops channel if any subscriber could not be moved

add_action( 'benecaster_price_change_applied', function ( int $change_id, array $change, array $rows ): void {
    $failed = array_filter( $rows, static fn( array $r ): bool => 'failed' === $r['status'] );
    if ( [] !== $failed ) {
        my_ops_alert( sprintf( '%d subscribers could not be moved on price change #%d', count( $failed ), $change_id ) );
    }
}, 10, 3 );

Notes

A failed row can be re-queued with POST /price-changes/{id}/retry (or, for a buy-up's latest change, POST /buyups/{id}/migrate), after which this fires again. A row's user_id can be null — a personal-data erasure anonymises the person's row (user_id and message cleared, the rest kept). A row erased before it applied ends skipped with skip_reason cancelled, and benecaster_price_change_subscriber_applied does not fire for it. Guard any per-row get_userdata() against null. Recipe: See price-change-cohort.

Need this built rather than just documented? See our services →