Support » Plugin: WooCommerce » How to remove phone number prefix entered in checkout?

  • Resolved snippet24


    Basically I’m trying to remove the phone number prefix say +56 from the entered full number so that in the created / generated order it only includes the number without the prefix.

    I have tried this, but didn’t work so far:

    function remove_prefix_checkout_field_input_type_phone_number() {
    echo "<script>document.getElementById('billing_phone').pattern = '(^[\s\S]{0,3}]';</script>";
    add_action( 'woocommerce_after_checkout_form', 'remove_prefix_checkout_field_input_type_phone_number');
    • This topic was modified 5 months, 2 weeks ago by snippet24.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter snippet24


    Oh there was a typo should be “(^[\s\S]{0,3})” still is not working though

    Plugin Support Mashi


    Hello @snippet24!

    The country code selector doesn’t show up on sites with only the WooCommerce plugin and some default themes like Storefront or Twenty Twenty Two active.

    So I believe you are using some plugin/custom code to show country code on the phone number field of your checkout page. Right?

    If that is the case then you can remove that plugin/custom code to hide the country code from your checkout page.


    In case I failed to understand your request properly please share your WooCommerce System Status on this thread so we can take a look at your configuration and check the issue further:

    System Status: You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”. Once you’ve done that, paste it here in your response.

    Thread Starter snippet24


    Hi @shaonback2,


    That’s correct, a plugin.

    Point is however, that I prefer to use the plugin so that is clear that the prefix is considered which in turns is better user experience, but however the prefix is not supported for generating the label in the orders and currently has to be manually removed.

    • This reply was modified 5 months, 1 week ago by snippet24.
    • This reply was modified 5 months, 1 week ago by snippet24.
    Plugin Support Margaret S. woo-hc


    Hi @snippet24

    Thanks for confirming that you are using a plugin for the prefix.

    We recommend contacting the plugin’s support team directly who may help you set the best settings for their plugin.

    For direct assistance with code customizations, if need be, we recommend consulting with the WooCommerce Customizations Partners.

    Kindly note that this particular forum is for questions that are directly related to the features and functionality of the free WooCommerce plugin. While we’re experts on our own products, third-party plugins are best supported by their own developers.

    Plugin Support Margaret S. woo-hc


    This thread has been inactive for a bit, so I’m going to mark it closed. Hopefully, the above information was useful to you.

    Please feel free to open a new thread if you have any other questions related to core WooCommerce.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.