Add an informative custom message in Woocommerce Checkout page Add an informative custom message in Woocommerce Checkout page wordpress wordpress

Add an informative custom message in Woocommerce Checkout page


You could display it as a Woocommerce "success" notice in checkout page, this way:

add_action( 'woocommerce_before_checkout_form', 'print_donation_notice', 10 );function print_donation_notice() {    wc_print_notice( sprintf(        __("%s 3%% of this order will be devolved for charity associations, so an amount of %s.", "woocommerce"),        '<strong>' . __("Information:", "woocommerce") . '</strong>',        strip_tags( wc_price( WC()->cart->get_subtotal() * 0.03 ) )    ), 'success' );}

Code goes in function.php file of your active child theme (or active theme). Tested and works.

enter image description here