Stop showing a Benecaster price after it changes
This is for add-ons that display Benecaster’s own plan and add-on prices — an upgrade prompt, a plan comparison, an add-on browser inside wp-admin. If you are not rendering our pricing, you do not need this hook: a podcaster has no reason to advertise Benecaster’s prices on their own site, and their subscriber tier prices are their own data and unaffected by any of this.
Prices live on the Benecaster licence server, not in the plugin, so they can change under a site at any time. Anything built from them — a comparison table, a savings calculator, a cached snapshot of the add-on list — is stale the moment they do, and showing a customer a price that is no longer real is the kind of error people remember.
benecaster_pricing_data_changed fires when Benecaster fetches pricing and finds it has actually changed — not on every check, only on a genuine change. That is the signal to throw away whatever you derived from the old numbers.
Do not compute bundle savings yourself. The bundle total and its discount are worked out on the server and are not simply the visible add-on prices added up. Adding them up locally produces a number that looks plausible, disagrees with what the customer is actually charged, and stays wrong quietly. Always read them from the pricing data you were given.
Code
<?php
add_action( 'benecaster_pricing_data_changed', function ( array $pricing, ?string $previous, string $next ): void {
// Force a rebuild of any cached plan-comparison snapshot when prices move.
delete_transient( 'my_plan_comparison_html' );
}, 10, 3 );
Hooks Used
Need this built rather than just documented? See our services →