Skip to main content
SureCart fires filters and actions when models are hydrated with data. These hooks allow you to modify model properties, add dynamic computed properties, or transform data as it’s being populated into the model.

surecart/{object_name}/attributes_set

Fired after all attributes are set on a model. Useful for adding computed properties or modifying model data after it’s been fully populated.

surecart/{object_name}/attributes/{key}

Filter individual attribute values as they are being set on a model during hydration. This allows you to transform, validate, or modify any attribute before it’s stored on the model. Parameters:
  • $value (mixed) – The value being set for the attribute
  • $model (Model) – The model instance
Returns: The filtered value to be stored
Use this filter to create dynamic computed properties, normalize data formats, or add display-ready versions of raw values.

surecart/{object_name}/set_meta_data

Filter metadata before it’s set on a model during hydration. Useful for ensuring metadata structure, adding defaults, or transforming metadata values. Parameters:
  • $meta_data (array|object) – The metadata being set
Returns: The filtered metadata

Available Models

You can hook into hydration events for these models:
  • subscription - Subscription data
  • purchase - Purchase data
  • product - Product data
  • price - Price data
  • customer - Customer data
  • order - Order data
  • checkout - Checkout data
  • charge - Payment charge data
  • refund - Refund data
  • invoice - Invoice data
  • coupon - Coupon data

Products

Hook into product creation, updates, and deletion events.

Purchases

Higher-level purchase events built on model actions.