I have a WP/Woocommerce based website, and I would like to inform my clients that, whenever they buy something in my shop, the 3% of their order is devolved for charity associations.
I would like to display the exact amount calculated on the total, for example: Total: 150 €
5 € will be devolved etc.
How can I manage it?
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.