WooCommerce Notice, run only once

Which action do you add with the function sp_custom_notice? If you use



add_action('wp', 'sp_custom_notice')


It will be called multiple times.



Try to hook up with other action:



add_action( 'woocommerce_before_checkout_form', 'sp_custom_notice' );


So the notice will only shows one time when the checkout page is displayed.


More: