-
Notifications
You must be signed in to change notification settings - Fork 0
/
iconic-woo-delivery-slots-compat-local-pickup-plus.php
48 lines (40 loc) · 1.4 KB
/
iconic-woo-delivery-slots-compat-local-pickup-plus.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* Plugin Name: WooCommerce Delivery Slots by Iconic [Local Pickup Plus by SkyVerge]
* Plugin URI: https://iconicwp.com/products/woocommerce-delivery-slots/
* Description: Compatibility between WooCommerce Delivery Slots by Iconic and 'Local Pickup Plus' by SkyVerge.
* Author: Iconic
* Author URI: https://iconicwp.com/
* Text Domain: iconic-woo-delivery-slots-compat-local-pickup-plus
* Domain Path: /languages
* Version: 0.1.0
*
* @package Iconic_Woo_Delivery_Slots_Compat_Local_Pickup_Plus
*/
/**
* Is Local Pickup plus active?
*
* @return bool
*/
function iconic_compat_local_pickup_plus_is_active() {
return class_exists( 'WC_Local_Pickup_Plus_Loader' );
}
/**
* Change format of the shipping method ID.
*
* @return array
*/
function iconic_compat_local_pickup_plus_update_shipping_method_id( $shipping_method_options ) {
if ( ! iconic_compat_local_pickup_plus_is_active() ) {
return $shipping_method_options;
}
$updated_shipping_method = array();
foreach ( $shipping_method_options as $method_key => $method_name ) {
if ( 'wc_shipping_local_pickup_plus' === $method_key ) {
$method_key = 'local_pickup_plus';
}
$updated_shipping_method[ $method_key ] = $method_name;
}
return $updated_shipping_method;
}
add_filter( 'iconic_wds_shipping_method_options', 'iconic_compat_local_pickup_plus_update_shipping_method_id', 10 );