Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Hide \’WooCommerce Local Pickup Time Select\’ when it is not a pickup

[vc_row][vc_column width=\”1/1\”][vc_column_text]There are many cases where a bricks and mortar shop selling online may want to offer their customers the option to collect in person at the shop. Though there are many options available in the form of WordPress Plugins, it seems that none of the options completely fit the real-life requirements of a retail business needing this as an effective Solution.

One Plugin stands out above all others. The best solution for this scenario is WooCommerce Local Pickup Time Select by Matt Banks. A simple Plugin in which you can you can set start and end times for order pickups each day. As well as define days the shop is closed. It also allows you to select a time interval for allowing pickups. In addition, you can specify a time delay between when a customer places their order and when they can pickup their order to account for processing time, as well as how many days ahead a customer can choose for their delivery.

The problem arises when you have a delivery and a local pickup shipping options. The pickup date/time box will show up regardless of which shipping method you choose. Worse still, it is a required field, meaning that it is mandatory even if you are selecting the delivery option.

The solution has taken a while to figure out and a lot of research. It is clear that the field does not need to be required as that means that standard deliveries will need to select a date and time. And we don\’t want that. We also need to remove the error message if it is not selected.

And so thus.

The solution is simple enough; we need to find where it states that it is a \’required\’ field. Secondly, we need to remove the message snippet.

Both can be found in the file \’class-local-pickup-time.php\’ in the directory here:

/yourwebsite/wp-content/plugins/woocommerce-local-pickup-time-select/public/

Open up the file \’class-local-pickup-time.php\’ and find the line:

‘required’ => true,

(this is currently at about line 550)

Change this to:

‘required’ => false,

Next, you need to find the section with the error message:

/**
* Process the checkout
*
* @since    1.03.0
*/
public function field_process() {
global $woocommerce;

// Check if set, if its not set add an error.
if ( !$_(!$_POST[‘local_pickup_time_select’] )
$woocommerce->]) wc_add_error( __(notice(__( ‘Please select a pickup time.’, $this->plugin_slug ) );), ‘error’);

}

}

Remove this entire section.

You will then need to upload this to your live environment to get this working.

This isn\’t necessarily the absolute best solution but it is a quick solution and may save you a whole heap of time that you might otherwise spend trying to find a Plugin that already does this (which at the time of writing just doesn\’t seem to exist).[/vc_column_text][/vc_column][/vc_row]



This post first appeared on Creative Sprout, please read the originial post: here

Share the post

Hide \’WooCommerce Local Pickup Time Select\’ when it is not a pickup

×

Subscribe to Creative Sprout

Get updates delivered right to your inbox!

Thank you for your subscription

×