Display a success custom notice after Placing an Order in WooCommerce



PHP Snippet 1:

add_action( 'woocommerce_before_thankyou', 'success_message_after_payment' );
function success_message_after_payment( $order_id ){
    // Get the WC_Order Object
    $order = wc_get_order( $order_id );

    if ( $order->has_status('processing') ){
        wc_print_notice( __("Your payment has been successful", "woocommerce"), "success" );
    }
}

PHP Snippet 2:

wc_print_notice( __("Your payment has been successful", "woocommerce"), "success" );

PHP Snippet 3:

echo '<p class='cudtom-message"> . __("Your payment has been successful", "woocommerce"), "success" ) . '</p>';