Skip to main content
These hooks allow you to respond to product events and customize how products are displayed.

Actions

Actions fire when products are created, updated, deleted, or when stock levels change.

surecart/product_created

Fires when a new product is created.
Action Parameters

surecart/product_updated

Fires when a product is updated.
Action Parameters

surecart/product_deleted

Fires when a product is deleted.
Action Parameters

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.
Action Parameters
Stock Properties:
Low available stock alert:
Sync product and variant stock levels:

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.

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/
Filter Parameters
Always use the first assigned collection:
Prioritize a specific collection when present:
Exclude certain collections from URLs:

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.
Filter the limit for related products 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:
Allow previewing draft products:
Remove post restriction for page builders:

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’s render_block filter and the HTML Tag Processor.

Templates

Learn how to modify block HTML, add custom attributes, wrap content, and inject elements into templates.

Currency

Customize how prices are formatted.

Templates

Modify reviews, blocks, and media display.