Phone number mandatory for pickup

Phone number mandatory for pickup

Charcopp14
Tourist
19 0 8

Hello

Right now customers have to option to choose pick-up or delivery. 

For delivery customers need to leave there phone number and I can make it a mandatory field. 

However this field is not mandatory when customers choose pick-up. I need it to be mandatory because we don't have standard opening hours in our shop. So we need to set up an appointment. 

Pleas help me 🙂

Replies 2 (2)

Dotsquares
Shopify Partner
433 28 54

hi @Charcopp14 


Hello,

Thanks for reaching out!

To make the phone number field mandatory for customers selecting pick-up, you can implement conditional logic. Here’s how you can do it:

If using a form plugin (like WPForms, Gravity Forms, etc.): You can set up conditional logic that checks if the customer chooses "Pick-up" and then marks the phone number field as required.

If using WooCommerce: You can use custom code to make the phone number field mandatory when the "Pick-up" option is selected. Here's a sample code you can add to your theme's functions.php file:

 

function custom_checkout_fields( $fields ) {
    if ( isset( $_POST['shipping_method'][0] ) && 'local_pickup' === $_POST['shipping_method'][0] ) {
        $fields['billing']['billing_phone']['required'] = true;
    }
    return $fields;
}
add_filter( 'woocommerce_checkout_fields', 'custom_checkout_fields' );

 

This will ensure that customers choosing pick-up must enter a phone number.

Dotsquares Ltd


Problem Solved? ✔ Accept and Like solution to help future merchants.


Shopify Partner Directory | Trustpilot | Portfolio

Easify-Jolie
Shopify Partner
282 9 26

Hi @Charcopp14 

I recommend trying Easify Product Options for this. With its conditional logic and number box, you can show or require the phone number field only when customers choose "Pick-up" — exactly what you need for setting appointments. It’s super easy to set up, no coding required. You just create the options, set the logic, and you're good to go 👍 Here's how it works:

  • This is the result:

EasifyJolie_1-1747112056292.png

 

EasifyJolie_2-1747112090525.png

 

  • This is the app setting:

EasifyJolie_3-1747112109921.png

 

To ensure the Number Box show up only when Pickup is selected as shipping method, simply set up Conditional Logic in the Advanced Settings like this:

EasifyJolie_4-1747112261674.png

 

You’ll find this app easy to use, so I hope you give it a try. If you need assistance, just let me know or reach out to Easify! 🤗

Easify Product Options: Any product options app can help you create custom options, but Easify turns those options into sales and conversions!
Easify Inventory Sync: Automate inventory syncing for Bundles, Duplicates, and Raw Materials. Say goodbye to manual tracking headaches.
Easify Product Attachments: Enrich your store with downloadable content. Easily add PDFs and other files to product or any page.
>>> Try Apps for Free | 24/7 Live Chat Support