WordPress block verus short codes

Newbie to developing wordpress plugin's and spent hour and hours trying to work out why hooks were not working. For example: // Function to be triggered by the woocommerce_after_checkout_form hook function ucig_after_checkout_form() { ucig_write_log("woocommerce_after_checkout_form triggered"); // Example: Output a custom message below the checkout form echo '<p style="color: red;">This is a custom message after the checkout form.</p>'; } // Hooking the function to woocommerce_after_checkout_form add_action('woocommerce_after_checkout_form', 'ucig_after_checkout_form'); All this is doing is writing to log file in my word press plugin directory as I try and debug. This just would not trigger. It was not until I read this answer Woocommerce 8.6.1 checkout form hooks not fired that I got it to work by putting in shortcode and removing the block. Boom worked. The question how do you make something like this work in the block method (or whatever it is called), and where is the doco/ what am I missing? This question is posted in the hope of helping others because in my case I am just using the short code and have moved on.

Comment (0)

You’ll be in good company