Skip to main content
These hooks allow you to respond to checkout events and customize the checkout experience.

Actions

Actions are triggered during the checkout process and when orders are confirmed. This is at the end, after payment is successuflly confirmed by the processor.

surecart/checkout_confirmed

Fired after an order is confirmed and all purchases have been processed. Use this for post-checkout operations like analytics tracking, external notifications, or custom logging.
Action Parameters

Filters

Form Validation

These filters run during the finalize step of checkout, before the order is submitted. Use them to validate form data and prevent checkout if validation fails.

surecart/checkout/validate

Add custom server-side validation to checkout forms. This filter runs during the finalize step, after client-side validation passes but before the order is submitted to the payment processor.
Filter Parameters
Validate Email Domain
Block specific email domains from purchasing:
Validate Custom Fields
Validate custom form fields added to your checkout:
Validate Based on Form ID
Apply validation only to specific checkout forms:

User Creation

surecart/checkout/auto-login-new-user

Control whether newly created users are automatically logged in after checkout.

Display

surecart_checkout_show_converted_total

Control whether converted currency totals are shown when using currency conversion.

sc_checkout_price_selector_first_price_as_default

Control whether the first price is selected by default in price selectors.

Payment Mode

surecart/payments/mode

Filter the payment mode (live/test). Useful for testing or staging environments.

JavaScript Filters

SureCart provides JavaScript filters using the WordPress hooks system (wp.hooks) to customize the Stripe Payment Element. These filters allow you to modify payment method order, wallet visibility, legal terms display, and billing fields.
These filters use the @wordpress/hooks package, which is automatically available on pages with SureCart checkout.

Payment Method Order

Use surecart_stripe_payment_element_payment_method_order to reorder the payment methods displayed in Stripe’s Payment Element.
See the Stripe Payment Element documentation for available payment method types.

Wallet Visibility

Use surecart_stripe_payment_element_wallets to control the visibility of digital wallets like Apple Pay, Google Pay, and Link within the Payment Element.
See the Stripe wallets documentation for more options. Use surecart_stripe_payment_element_terms to manage the display of mandates and other legal agreements within the Payment Element. By default, these are shown only when necessary.
See the Stripe terms documentation for available options.

Billing Fields

Use surecart_stripe_payment_element_fields to control which billing address fields are displayed within the Stripe Payment Element. This is useful when you’re already collecting billing information elsewhere in your checkout form.
To show specific fields, simply remove them from the object or set them to 'auto'. For example, to hide all fields except country:
See the Stripe fields documentation for all available options.

Address Countries

Use surecart_address_countries to customize the list of countries available in address fields. You can add, remove, reorder, or translate country names.
To add custom JavaScript filters to your site, you can use plugins like Simple Custom CSS and JS. Be sure to load scripts in the footer for checkout page compatibility.
Each country object must include both value (ISO country code) and label (display name) properties.

Address Regions

Use surecart_address_regions to customize the regions (states, provinces, etc.) available for specific countries. You can add, remove, or translate region names.
The filter receives the current regions array and the country code. Each region object must include both value and label properties.

Use Cases

Analytics & Conversion Tracking

Send to Slack

Validate Minimum Order Amount

Restrict Purchases by Country

Require Terms Acceptance

Validate Tax Identifier

Use the built-in tax_identifier field to validate VAT/tax ID numbers:

Force Test Mode for Non-Production

JavaScript Filter Use Cases

Sell Only to Specific Countries

Restrict your checkout to only allow purchases from certain countries:

Exclude Specific Countries

Remove certain countries from the dropdown while keeping all others:

Change County Name Translations

Change the transled country names to something different.

Prioritize Common Countries

Move your most common customer countries to the top of the list:

Prioritize Card Payments

Show card payment first for faster checkout:
Hide Stripe Link for recurring payments:

Show Bank Terms for High-Value Orders

Always display ACH terms for orders over a certain amount:

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.

Cart

Customize cart icon and visibility.

Login

Customize login redirects and authentication.

Purchases

Hook into individual purchase events.

Orders

Hook into order and payment events.

Templates

Modify blocks, shortcodes, and inject content.