Hi there!
Thank you for reaching out and for the detailed investigation you have already done.
You are correct that these heading tags are currently hardcoded within the Mini Cart block implementation. Since the Mini Cart is part of the newer Cart & Checkout Blocks system, it does not follow the traditional WooCommerce template override approach used by classic templates.
Please note that generally we do not provide support for customizations. If you need more in-depth support or want to consider professional assistance for customization, I can recommend WooExperts and Codeable.io as options for getting professional help. Alternatively, you can also ask your development questions in the WooCommerce Community Slack as custom code falls outside our usual scope of support.
Thanks for the response. However, I am not requesting custom code from you. I am asking what the process is to override content displayed by WooCommerce.
Your comment on “classic templates” indicates that there are some “modern templates” that WooCommerce has implemented? If hooks and “classic templates” are no longer in play, then what enables a programmer any longer?
Hi @suleski,
You’re right that WooCommerce blocks use a different extensibility model than classic templates. Here’s how it works:
For PHP-rendered blocks, WordPress core provides the render_block filter, which lets you intercept and modify the rendered HTML output of any block before it reaches the browser: https://developer.wordpress.org/reference/hooks/render_block/. You can target specific WooCommerce blocks by checking the $block['blockName'] argument:
add_filter( 'render_block', function( $block_content, $block ) {
if ( $block['blockName'] === 'woocommerce/mini-cart-title' ) {
// Modify $block_content here — e.g. replace h2 with h3
$block_content = str_replace( '<h2', '<h3', $block_content );
$block_content = str_replace( '</h2>', '</h3>', $block_content );
}
return $block_content;
}, 10, 2 );
This is currently the most reliable approach for modifying hardcoded output from WooCommerce block PHP render methods where no dedicated filter hook has been added by the WooCommerce team.
For JavaScript/frontend block customizations, WooCommerce also exposes a @woocommerce/blocks-checkout JavaScript API with slot/fill components and ExperimentalOrderMeta style extensibility points, but that’s more relevant for adding content than changing existing markup.
The WooCommerce blocks extensibility documentation is here for reference: https://github.com/woocommerce/woocommerce/tree/trunk/plugins/woocommerce-blocks/docs/third-party-developers/extensibility
I hope that gives you the handle you were looking for!
Hi @frankremmy! Yes, thanks for that. It looks like the “render_block” hook did the trick.
And, after investigating the DOM, I see that the ‘blockName’ is also mentioned as the “data-block-name” attribute, so now I may have a more straightforward way to narrow down what I may need to reference if in need of analyzing or changing up the HTML.
Hi there!
Fantastic! I’m thrilled we could resolve this for you quickly
Also, using the render_block filter is indeed the most reliable way to modify WooCommerce block output when there isn’t a dedicated hook available.
Also, you’re absolutely right about the data-block-name attribute it can be very helpful for identifying WooCommerce blocks in the frontend DOM and makes targeting specific blocks much easier when debugging or applying conditional changes.
Before you go, If you felt supported through the issue, a quick review on WordPress.org would mean a lot. It helps others feel confident choosing it, knowing there’s help when they need it.
Leave a review here: https://wordpress.org/support/plugin/woocommerce/reviews/#new-post