0

enter image description hereI wonder if anyone knows an action to make the phone number field become a link that calls whatsapp in the order details on the administrator's side woocommerce

2
  • Hello Moises. Please edit your question and use English.
    – Sally CJ
    Commented Jul 10, 2020 at 19:32
  • Share a screenshot, where adjectly you want to add the link. Commented Jul 10, 2020 at 20:07

1 Answer 1

0
add_action( 'admin_footer', function() {
    if ( get_current_screen()->post_type == 'shop_order' ) {
?>
<script>

    jQuery( function($) {

        function tel_to_wa() {
            var wa = '//wa.me/51';
            var tel = $( 'a[href*="tel:"]');
            tel.attr({
                href: wa + tel.text(),
                target: '_blank'
            });
        }

        tel_to_wa();

        $( '.order-preview' ).click( function() {
            $(document).ajaxComplete( tel_to_wa );
        });

    });

</script>
<?php
    }
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.