在 WooCommerce 结帐 header 标题前添加 html 代码

Add html code before checkout header title on WooCommerce

我需要一个函数来在 WooCommerce checkout header title 之前添加 HTML 代码。我想添加一个进程栏。

谢谢

Checkout 标题位于您主题的 header.php 中。所以没有任何 WooCommerce 挂钩。

因此,您可以使用 the dedicated WooCommerce conditional tag is_checkout() 完成编辑活动 child 主题(或活动主题)的 header.php 文件:

<?php if( is_checkout() ): ?>
    <!-- HERE GOES YOUR HTML CODE DISPLAYED ONLY IN CHECKOUT HEADER -->
<?php endif; ?>

其他更新:

For checkout only and not order recieved (thank you):

<?php if( is_checkout() && ! WC()->cart->is_empty() ): ?>
    <!-- HERE GOES YOUR HTML CODE DISPLAYED ONLY IN CHECKOUT HEADER -->
<?php endif; ?>