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/
Images
surecart/product-line-item-image/fallback_src
Filter the fallback image for product line items when no image is set.
surecart/product-list/thumbnail-cover-size
Filter the thumbnail size for product list items.
Related Products
surecart_product_related_posts_query_limit
Filter the limit for related products query.
surecart_product_related_posts_query
Filter the related products SQL query for advanced customization.
Product Page
surecart_product_page_query_args
Filter the WP_Query arguments used to fetch the product on a product page. By default, this queries a single published product by its post ID.
Default query args:
Use Cases
Sync Product Metadata to External System
Low Stock Notifications
Use Custom Placeholder Image
Modifying Templates
You can customize the HTML output of SureCart blocks using WordPress’srender_block filter and the HTML Tag Processor.
Templates
Learn how to modify block HTML, add custom attributes, wrap content, and inject elements into templates.