Advanced settings, scripts, and tools

CheckoutWC » Advanced holds settings most stores never need to change: how CheckoutWC loads its pages, troubleshooting tools, your own scripts and code, and settings backup. It has three tabs, Advanced, Scripts and Tools. Click Save Changes after changing a setting.

When you’d use this

  • You’re troubleshooting and need the debug log.
  • You want to add a tracking script, custom HTML or a PHP snippet to the checkout.
  • You want your theme’s header and footer on the checkout.
  • You’re moving CheckoutWC’s settings to another site.

Advanced tab

Template Loader

How CheckoutWC shows its checkout, order pay and thank you pages:

  • Distraction Free Portal (Recommended): the default. CheckoutWC shows its own page without your theme’s header, footer, styles or scripts, so nothing distracts customers or conflicts with the checkout.
  • WordPress Theme: shows CheckoutWC’s checkout inside your theme’s page content area, with your theme around it. This is marked “Unsupported Configuration”: your theme’s styles and scripts can conflict with the checkout, and fixing those conflicts is up to you.

Enable Beta Version Updates

Offers beta versions of CheckoutWC as plugin updates. Off by default; leave it off on a live store.

Delete Plugin Data on Uninstall

Deletes CheckoutWC’s settings when you delete the plugin. Off by default. It doesn’t delete order bumps, cart recovery emails or other content you’ve created.

Hide Admin Menu Bar Button

Hides CheckoutWC’s button in the WordPress admin bar, except on the checkout, order pay and thank you pages.

Enable Debug Log

Records debug information you can view under WooCommerce » Status » Logs, in logs named checkout-wc, including why the express checkout buttons did or didn’t show on the checkout. Support may ask you to turn it on. Errors, such as a PHP snippet that won’t run, are logged even with this off.

Enable Usage Tracking

Sends information about your site to CheckoutWC once a week to help us improve the plugin. It includes your site’s address; your WordPress, WooCommerce, PHP and CheckoutWC versions; your theme and plugins; your payment and shipping methods; some WooCommerce and CheckoutWC settings; and order statistics for the last four weeks. Off unless you turn it on.

Scripts tab

Who can change scripts and snippets

The Scripts tab, both the script boxes and PHP Snippets, can only be changed by users with WordPress’s unfiltered_html permission. Administrators have it on a single site. On a multisite network only super admins have it, and nobody has it when DISALLOW_UNFILTERED_HTML is set in wp-config.php. Without it, the tab says “Scripts and PHP snippets need the unfiltered_html permission, which your account does not have.” and the boxes can’t be saved.

Add HTML, such as <script> or <style> tags for analytics or chat tools, to CheckoutWC’s pages. Global scripts load on the checkout, thank you and order pay pages; the Checkout, Thank You and Order Pay sections add scripts to that page only. Header scripts go just before </head>, and footer scripts just before </body>. These boxes take HTML only; use PHP Snippets for PHP.

PHP Snippets

Under Global, PHP Snippets runs PHP code you add, without the opening <?php tag. The code runs on every page of your store, not just the checkout, while CheckoutWC is switched on. It doesn’t run in the WordPress admin, or when CheckoutWC is bypassed for testing.

Because the code runs on your live store, a mistake can break pages. CheckoutWC catches syntax errors and logs them instead of running the code, but it can’t catch every error. If a snippet breaks your store, remove it from this box; the WordPress admin keeps working because snippets don’t run there.

For snippets that also need to run in the WordPress admin or very early in WordPress’s loading, use a code snippets plugin or your child theme’s functions.php.

The default Distraction Free Portal loader leaves out your theme’s header and footer. To show them:

  • Elementor Pro, Beaver Themer or Astra: turn on Enable Elementor Pro support., Enable Beaver Themer Support or Enable Astra Support (Beta) under Themes and Plugins on CheckoutWC » Integrations. The option appears when that plugin or theme is active. CheckoutWC then uses the header and footer you’ve set up there; with Elementor Pro and Beaver Themer, set them to display on the checkout. Beaver Themer’s header and footer show on the checkout and order pay pages, not the thank you page.
  • Any theme: switch Template Loader to WordPress Theme, accepting that it’s unsupported.
  • Developers: output your own header and footer with the cfw_custom_header and cfw_custom_footer actions. Anything hooked there replaces CheckoutWC’s own header or footer. These work with the Distraction Free Portal loader.

Add custom HTML to the checkout

Developers can add HTML at points on the checkout with CheckoutWC’s actions. For example, to add a block below the cart summary on the checkout, thank you and order pay pages:

add_action( 'cfw_after_cart_summary', function () {
    echo '<div class="my-store-note"><p>Free returns within 30 days.</p></div>';
} );

For HTML without code, add an HTML item to a slot in the Checkout Editor. The Actions reference lists every action.

Turn CheckoutWC off for a user role

To give some customers WooCommerce’s standard checkout, for example wholesale customers, define the CFW_DISABLE_TEMPLATES constant for them early in WordPress’s loading. Add this to your child theme’s functions.php, a code snippets plugin or a must-use plugin, not the PHP Snippets box, which runs too late:

add_action( 'init', function () {
    if ( ! is_user_logged_in() ) {
        return;
    }
    if ( in_array( 'wholesale_customer', (array) wp_get_current_user()->roles, true ) ) {
        define( 'CFW_DISABLE_TEMPLATES', true );
    }
}, 0 );

Replace wholesale_customer with the role’s slug. This also turns CheckoutWC off for administrators with that role.

Tools tab

  • Export Settings downloads your CheckoutWC settings as cfw-settings.json. It includes settings and logos, not order bumps, cart recovery emails, pickup locations or other content. It leaves out your license key and integration secrets, such as your Turnstile secret key and Smarty and Fetchify credentials.
  • Import Settings replaces your settings with those from an export file. Choose the file and click Upload File and Import Settings. You’ll see “CheckoutWC Settings Import Successful” when it’s done. Only CheckoutWC’s own settings are imported; anything else in the file is ignored, and the notice says how many entries were ignored. If your account doesn’t have the unfiltered_html permission, scripts and PHP snippets in the file are skipped too, and a “Some settings were not imported” notice lists them.

Common issues

“Wrong file extension. Uploaded settings must be a JSON file.”

Import only accepts the .json file from Export Settings.

My PHP snippet doesn’t do anything

CheckoutWC is switched off, or bypassed, for that visitor; or the code needs to run earlier than init, or in the WordPress admin. Move it to a code snippets plugin or your child theme’s functions.php.

The checkout looks broken with the WordPress Theme loader

Your theme’s styles or scripts conflict with the checkout. Switch back to Distraction Free Portal (Recommended).

Keep learning