I wanted to do a line break in the Whatsapp URL message while the message is generated in sprintf and then goes through the urlencode.
code below
$msg = sprintf( __("Hello %s %s, your order #%s has been received. The order amount is %s %s. Your payment method is %s. Please Confirm your order by replying *Confirm*. Please contact us if you have any question regarding your order. You can view your order here ".$orderlink." Thank you.", "woocommerce"),
$order->get_billing_first_name(),
$order->get_billing_last_name(),
$order->get_order_number(),
$order->get_currency(),
$order->get_total(),
$order->get_payment_method_title(),
);
$whatsappnum = WC()->countries->get_country_calling_code( $order->get_billing_country() ) . $order->get_billing_phone();
update_post_meta( $_GET['order_id'], '_wapp_sent_processing', 'true' ); // Mark order as WhatsApp message sent
wp_redirect( 'https://wa.me/' . $whatsappnum . '?text=' . urlencode($msg) ); // Redirect WhatsApp
this message is generated for woocommerce orders and a action button is sending it to buyers whatsapp.
currently, the message is displayed in WhatsApp without any linebreak
I want this message to have linebreaks to look more clean and easy to read.
Thanks