Mirror built-in tier CRUD into an external CRM, billing dashboard, or reporting pipeline
These actions fire after each successful tier create, update, delete, and reorder. Create and update receive the full hydrated tier array (tier_slug, tier_name, monthly_price, annual_price, is_free, is_active, description, tier_order, show_id); delete receives only the IDs and slug. tier_slug is immutable — treat it as the stable external key. monthly_price and annual_price are float|null (null means free-only tier).
A reorder on Memberships → Tiers fires benecaster_membership_tiers_reordered once for the show — never benecaster_membership_tier_updated per tier. Rank is a tier’s position in the $tier_ids array (0 = lowest), not a raw tier_order value.
Code
<?php
add_action( 'benecaster_membership_tier_created', function ( int $tier_id, array $tier ): void {
my_crm_upsert_plan( [
'external_id' => 'benecaster:' . $tier['show_id'] . ':' . $tier['tier_slug'],
'name' => $tier['tier_name'],
'monthly' => $tier['monthly_price'],
'annual' => $tier['annual_price'],
'active' => $tier['is_active'],
] );
}, 10, 2 );
add_action( 'benecaster_membership_tier_deleted', function ( int $tier_id, int $show_id, string $tier_slug ): void {
my_crm_deactivate_plan( 'benecaster:' . $show_id . ':' . $tier_slug );
}, 10, 3 );
// A reorder on Memberships → Tiers fires this once for the show, NOT
// benecaster_membership_tier_updated per tier. Rank = position (0 = lowest).
add_action( 'benecaster_membership_tiers_reordered', function ( int $show_id, array $tier_ids ): void {
foreach ( $tier_ids as $rank => $tier_id ) {
my_crm_set_plan_rank( $show_id, $tier_id, $rank );
}
}, 10, 2 );
Hooks Used
Need this built rather than just documented? See our services →