NO BUG: Woocommerce checkout page hooks not working

@thomas | @timmse @itchycode

Bricks Version: 1.6.2

I want to separete the section in Chekout order reivew widget with custom titles, so i made some snippets for it.

But lots of Hooks not working or working bad.

Example:

woocommerce_review_order_before_payment is working good

But when i add title with snippet to shipping choice (woocommerce_review_order_before_shipping)
It is put top of the order review widget, and duplicate the title!

Here is my snippet:

//Add title to payment section
add_action( 'woocommerce_review_order_before_payment', 'wc_payment_title' );
 
function wc_payment_title() {
   echo '<h3 class="payment-choices-title">Fizetési mód</h3>';
}

//Add title to Shipping section
add_action( 'woocommerce_review_order_before_shipping', 'wc_shipping_title' );
 
function wc_shipping_title() {
   echo '<h3 class="shipping-choices-title">Szállítási mód</h3>';
}

Hey,
Thanks a lot for your report, but there is no reason to tag anyone of us :wink:

We’ll check this out and get back to you as soon as possible.

Best regards,
timmse

Hi @simplecreative ,

After investigation, this is nothing to do with the Bricks checkout page.
You can test your code in another theme and the same problem will occur.

You need to tweak your code to only execute when it’s not doing AJAX.

Example:

 add_action( 'woocommerce_review_order_before_payment', 'wc_payment_title' );
 
 function wc_payment_title() {
	// Only execute if it's not AJAX
	if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) {
		echo '<h3 class="payment-choices-title">Fizetési mód</h3>';
	}
 }
 
 
 add_action( 'woocommerce_review_order_before_shipping', 'wc_shipping_title' );
  
 function wc_shipping_title() {
   // Only execute if it's not AJAX
   if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) {
	 echo '<h3 class="shipping-choices-title">Szállítási mód</h3>';
   }
 }
 

Regards,
Jenn

3 Likes

Thanks your answer and work.
I dont know why do you think, it is not working other theme, because I made it in past another (not bricks) site and the snippet was from businessbloomer (if my memory is good :smiley: )

I will test your solution in bricks. Thanks again!

Hey @simplecreative I’m experiencing the same issue. Did you manage to find a solution to place a custom title above the Shipping Options?

Normally, you use the woocommerce_review_order_before_shipping hook to place the title above the Shipping methods. But I feel that the way the Bricks checkout order table is build, the hook is not on the right place anymore.

Hope you can help, thanks!

Unfortunately, I will not be able to help with this, I have already initiated communication with the makers of Bricks on several occasions, but I have not really succeeded.

Unfortunately, the handling of Bricks Hooks is not as good (or does not work as well) as people have become accustomed to and expected in the last 10-15 years using wordpress.

Maybe @itchycode can help you / us, but he is quite busy.

Thanks for your response, I will create a how to post for this. Maybe someone here found a workaround.