Disable block-based WooCommerce
November 27, 2024 ยท AI Conversations
### 1. **Disable WooCommerce Block Templates**
WooCommerce started using block-based templates for the checkout and other pages starting from version 5.8. To disable the block-based templates and revert to the classic templates, you can add the following code to your theme's `functions.php` file:
add_filter( 'woocommerce_use_block_template', '__return_false' );
This filter will tell WooCommerce not to use the block templates.
### 2. **Switch to Classic Templates**
WooCommerce will use its classic templates instead of block-based ones once you disable the block templates. Ensure you have the correct version of WooCommerce that supports the classic templates. If for some reason, you still see block-based pages after this, make sure:
– Your theme doesn't enforce block templates via custom template overrides.
– There are no plugins that force block-based checkout templates.
### 3. **Optional: Remove Block-Related Plugins**
If you don't need the block-based checkout or other pages, you can disable or remove plugins that provide the block templates, such as:
– **WooCommerce Blocks**: This plugin enables block-based checkout and cart functionality. You can deactivate it if you no longer need block templates.
### 4. **Revert Specific WooCommerce Pages**
If you want to customize or revert the checkout page to a custom template, you can do that by overriding the WooCommerce templates:
– Copy the `checkout` template from the WooCommerce plugin directory (`wp-content/plugins/woocommerce/templates/checkout`) to your theme's folder, under `wp-content/themes/your-theme/woocommerce/checkout`.
– Modify this template as needed.
### 5. **Test the Changes**
After making these changes, visit your WooCommerce checkout, cart, and other pages to ensure they are now using the classic templates.
This should effectively remove the block-based checkout and revert to using the classic WooCommerce templates.