I want to include the full order link in a message to my whatsapp. After completing the purchase, the customer will click this link to send his order to my whatsapp.
add_action( 'woocommerce_thankyou', 'send_order_link' );
function send_order_link( $order ) {
$link .= '<p><a href="https://wa.me/5513123456789?text=This is my order:'.$order->get_checkout_order_received_url.'">Send order</a></p>';
echo $link;
}
2
Answers
I did! I created a template to override the original woocommerce template order-details.php I inserted this line of code in the template:
you forgot to call function is not object. call as function
Instead of:❌
Use this:✅
.
Ref https://wp-kama.com/plugin/woocommerce/function/WC_Order::get_checkout_order_received_url