Skip to main content

benecaster_membership_price_deleted

Action Premium

Fires after a billing cadence is removed from a tier — either by deleting the cadence outright, or by reconciliation on PUT /membership-tiers/{id} when a stored cadence is absent from the submitted prices[] array.

Core hooks this action itself and archives the corresponding Stripe Price. Archiving stops new checkouts against that cadence; it does not touch anyone already subscribed on it, who keeps renewing at their rate.

Parameters

Name Type Default Description
$price_id int ID of the row that was removed.
$price array The full pre-delete row, including the Stripe Price IDs — the only place to read them after deletion.
$tier_id int ID of the tier the cadence belonged to.

Example

// Warn before withdrawing a cadence that still has subscribers on it.
add_action( 'benecaster_membership_price_deleted', function ( int $price_id, array $price, int $tier_id ) {
    $stripe_id = $price['stripe_price_id_live'];
    if ( ! $stripe_id ) {
        return;
    }

    error_log( sprintf(
        'Benecaster: cadence "%s" withdrawn from tier %d (Stripe Price %s archived). Existing subscribers keep renewing.',
        $price['cadence_label'],
        $tier_id,
        $stripe_id
    ) );
}, 10, 3 );

Notes

Deleting a tier cascades to every one of its cadences, so this fires once per cadence before benecaster_membership_tier_deleted. Order matters if your callback resolves the tier — read it from $tier_id while the tier still exists rather than querying for it later.

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