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, billing fields, and the underlying Elements configuration.
These filters use the
@wordpress/hooks
package, which is automatically available on pages with SureCart checkout.
Payment Method Order
Usesurecart_stripe_payment_element_payment_method_order to reorder the payment methods displayed in Stripe’s Payment Element.
Wallet Visibility
Usesurecart_stripe_payment_element_wallets to control the visibility of digital wallets like Apple Pay, Google Pay, and Link within the Payment Element.
Legal Terms Display
Usesurecart_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.
Billing Fields
Usesurecart_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.
'auto'. For example, to hide all fields except country:
Elements Configuration
Usesurecart_stripe_payment_element_elements_config to modify the Elements group options that wrap the Payment Element. This is a lower-level filter than the ones above: it receives the entire configuration object SureCart builds, including mode, amount, currency, setupFutureUsage, and appearance.
It is also where you control which payment methods Stripe offers, with excludedPaymentMethodTypes or paymentMethodTypes. See Hide a Payment Method for Specific Products.
Always return a complete configuration object. Spread the original config and override only the keys you need:
Address Countries
Usesurecart_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.
value (ISO country code) and label (display name) properties.
Address Regions
Usesurecart_address_regions to customize the regions (states, provinces, etc.) available for specific countries. You can add, remove, or translate region names.
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-intax_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:Disable Link Wallet for Subscriptions
Hide Stripe Link for recurring payments:Show Bank Terms for High-Value Orders
Always display ACH terms for orders over a certain amount:Hide a Payment Method for Specific Products
UseexcludedPaymentMethodTypes to remove individual payment methods while leaving the rest of Stripe’s automatic payment methods intact. This example hides Klarna when a specific product is in the cart:
item.price?.recurring_interval instead, for example, hides the method only for subscriptions. When the condition stops matching, returning config unchanged shows the method again.
Use the payment method’s Stripe API identifier, not its display name. Klarna is
klarna, Afterpay and Clearpay share afterpay_clearpay, and Cash App Pay is
cashapp. See Stripe’s payment method
types
for the full list. Link can’t be excluded this way. Stripe rejects link as
an excluded type, so hide it with Wallet Visibility
instead.paymentMethodTypes. This example allows only cards for subscriptions:
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.
Related
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.