Skip to main content
SetPriceOverride writes a custom price directly onto a SubscriptionItem, bypassing the plan’s default price for that subscriber. Use it to offer negotiated pricing, loyalty discounts, or temporary promotional rates on individual subscription items. When the override is cleared, the item reverts to the next price in the fallback chain (snapshot or live plan price).

Setting an override

Pass the Subscription, the target SubscriptionItem, a price in minor currency units (cents), and an optional expiry date.
use Pixelworxio\Subscribd\Actions\SetPriceOverride;

app(SetPriceOverride::class)->execute(
    $subscription,
    $item,
    999,   // $9.99 in minor currency units
);

Clearing an override

Pass null as the price to remove the override. Both price_override and price_override_expires_at are set to null.
use Pixelworxio\Subscribd\Actions\SetPriceOverride;

app(SetPriceOverride::class)->execute(
    $subscription,
    $item,
    null,
);

Parameters

ParameterTypeRequiredDescription
$subscriptionSubscriptionYesThe subscription that owns the item
$itemSubscriptionItemYesThe subscription item to override
$priceint|nullYesOverride price in minor currency units (cents), or null to clear
$expiresAtCarbonImmutable|nullNoWhen the override expires. null means permanent. Ignored when clearing.

Return value

Returns the updated SubscriptionItem model with refreshed attributes.

Validation

The action verifies that the SubscriptionItem belongs to the given Subscription. If the relationship does not match, a SubscriptionException is thrown.

Expiry behavior

When you set a time-limited override, the price_override_expires_at column stores the expiry date. The override remains active until that date passes. At renewal time, RenewSubscription detects expired overrides, clears them, and fires the SubscriptionPriceOverrideReverted event. Permanent overrides (no expiry) stay in effect indefinitely until you explicitly clear them.

Events fired

SubscriptionUpdated is dispatched after the override is saved.
use Pixelworxio\Subscribd\Events\SubscriptionUpdated;

Event::listen(SubscriptionUpdated::class, function (SubscriptionUpdated $event) {
    // $event->subscription — the Subscription model
});
When a time-limited override expires during renewal, SubscriptionPriceOverrideReverted is fired by the renewal process — not by this action.

Concurrency safety

The action runs inside a database transaction to ensure the item update, refresh, and event dispatch are atomic.