Actions
Actions fire when products are created, updated, deleted, or when stock levels change.surecart/product_created
Fires when a new product is created.
surecart/product_updated
Fires when a product is updated.
surecart/product_deleted
Fires when a product is deleted.
surecart/product_stock_adjusted
Fires when a product’s stock level changes (e.g., after a purchase or manual adjustment). Products with variants will have stock tracked at both the product and variant level.
| Property | Description |
|---|---|
stock | Total on-hand inventory count |
held_stock | Units purchased but not yet fulfilled/shipped |
available_stock | Units available for purchase (stock - held_stock) |
Filters
Filters allow you to customize how products are displayed, including SEO meta tags, images, and related products.Content Display
surecart/product/replace_content_with_product_info_part
Control whether product content is replaced with the product info template part. Return false to use custom templates.
Permalinks
sc_product_post_type_link_sc_collection
Filter which collection appears in product URLs when your permalink structure includes the collection slug.
When your product permalinks are configured to include the collection (e.g., /products/%sc_collection%/%product%/), a product URL might look like /products/clothing/blue-t-shirt/. But what happens when a product belongs to multiple collections, like both “clothing” and “sale”? This filter lets you control which collection slug is used in the URL.
Example scenario:
- Product “Blue T-Shirt” belongs to collections:
clothing,sale,featured - Without this filter, WordPress picks one (often unpredictably)
- With this filter, you can ensure the URL is always
/products/clothing/blue-t-shirt/instead of/products/sale/blue-t-shirt/