How to customize WooCommerce or Fluid Checkout template files

How to customize WooCommerce or Fluid Checkout template files

Because too many plugins and themes have their own versions of the WooCommerce template files Fluid Checkout also uses, we needed to force our template files to be used to have better compatibility with the greatest number of plugins and themes.

In order to customize a template file that Fluid Checkout uses, you need to:
  1. copy the template file from the Fluid Checkout plugin into your child theme, theme, or plugin; and
  2. tell Fluid Checkout to use your template file instead.

See the example below which tells Fluid Checkout to allow other themes or plugins to override the login forms templates:

  1. /**
  2.  * Override plugin template files with the theme version.
  3.  */
  4. function fluidcheckout_override_template_with_theme_file( $override, $template, $template_name, $template_path ) {
  5. $override_templates_list = array(
  6. 'global/form-login.php',
  7. 'fc/checkout/form-contact-login-modal.php',
  8. );
  9. if ( in_array( $template_name, $override_templates_list ) ) {
  10. $override = true;
  11. }

  12. return $override;
  13. }
  14. add_filter( 'fc_override_template_with_theme_file', 'fluidcheckout_override_template_with_theme_file', 10, 4 );

If you are using a custom child theme, the ideal location to add the hook is the functions.php file of the child theme. Unless you are developing a completely custom theme, we do not recommend changing the functions.php file.

For more information about adding code snippets and customizations, check our article: