Add a fixed cash on delivery fee that works with WooCommerce’s modern Block Checkout (React-based checkout), not just the classic shortcode checkout.
When the customer selects Cash on Delivery (e.g. cod, cheque) and the shipping method is not Local Pickup, the system adds a gross fee to the cart. A separate order-sync fix ensures the fee is saved into the order, so it also appears in order emails and admin order details.
function enable_gutenberg_for_woocommerce_products( $use_block_editor, $post_type ) {
if ( 'product' === $post_type ) {
return true;
}
return $use_block_editor;
}
add_filter( 'use_block_editor_for_post_type', 'enable_gutenberg_for_woocommerce_products', 10, 2 );What it does
- Enables the block editor for WooCommerce products
- Allows using core blocks, custom blocks, and patterns on product pages
- Works without plugins
- Keeps all WooCommerce product functionality intact
When to use
- You want consistent editing experience across posts, pages, and products
- You want to design product pages with Gutenberg instead of the classic editor
- You are building a block-based or FSE-ready theme
Reviews
There are no reviews yet.