|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* WooCommerce Addons filters and functions |
|
4
|
|
|
* |
|
5
|
|
|
* @package lsx |
|
6
|
|
|
* @subpackage woocommerce |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* WooCommerce Order Delivery Date |
|
11
|
|
|
*/ |
|
12
|
|
|
if ( function_exists( 'wc_od_get_delivery_date_field_args' ) ) { |
|
13
|
|
|
/** |
|
14
|
|
|
* Change the arguments for the checkout delivery date field. |
|
15
|
|
|
* |
|
16
|
|
|
* @package lsx |
|
17
|
|
|
* @subpackage woocommerce |
|
18
|
|
|
* @param $args array |
|
19
|
|
|
* @return array |
|
20
|
|
|
*/ |
|
21
|
|
|
function lsx_wc_delivery_date_args( $args = array(), $context ) { |
|
22
|
|
|
if ( 'checkout' === $context ) { |
|
23
|
|
|
$args['label'] = _x( 'Date', 'Delivery date checkout field label', 'lsx' ); |
|
24
|
|
|
} |
|
25
|
|
|
return $args; |
|
26
|
|
|
} |
|
27
|
|
|
add_filter( 'wc_od_delivery_date_field_args', 'lsx_wc_delivery_date_args', 10, 2 ); |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Change the title of the shipping and delivery title. |
|
31
|
|
|
* |
|
32
|
|
|
* @package lsx |
|
33
|
|
|
* @subpackage woocommerce |
|
34
|
|
|
* @param $args array |
|
35
|
|
|
* @return array |
|
36
|
|
|
*/ |
|
37
|
|
|
function lsx_wc_delivery_details_args( $args = array() ) { |
|
38
|
|
|
$args['title'] = _x( 'Collection or Delivery Time-slot', 'Delivery date title on checkout', 'lsx' ); |
|
39
|
|
|
return $args; |
|
40
|
|
|
} |
|
41
|
|
|
add_filter( 'wc_od_order_delivery_details_args', 'lsx_wc_delivery_details_args', 10, 1 ); |
|
42
|
|
|
add_filter( 'wc_od_checkout_delivery_details_args', 'lsx_wc_delivery_details_args', 10, 1 ); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* WooCommerce Points and Rewards |
|
47
|
|
|
*/ |
|
48
|
|
|
|
|
49
|
|
|
if ( ! class_exists( 'WC_Points_Rewards' ) ) { |
|
50
|
|
|
/** |
|
51
|
|
|
* Adds a div around the Points and rewards message. |
|
52
|
|
|
* |
|
53
|
|
|
* @param string $message |
|
54
|
|
|
* @param string $option |
|
55
|
|
|
* @return string |
|
56
|
|
|
*/ |
|
57
|
|
|
function lsx_wc_points_message_div( $message = '', $option = '' ) { |
|
58
|
|
|
if ( '' !== $message ) { |
|
59
|
|
|
$message = '<div class="lsx-woocommerce-message-text">' . $message . '</div>'; |
|
60
|
|
|
} |
|
61
|
|
|
return $message; |
|
62
|
|
|
} |
|
63
|
|
|
add_filter( 'option_wc_points_rewards_redeem_points_message', 'lsx_wc_points_message_div', 10, 2 ); |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Adds in the lsx wrapper class. |
|
67
|
|
|
* |
|
68
|
|
|
* @param string $message |
|
69
|
|
|
* @param boolean $discount_available |
|
70
|
|
|
* @return string |
|
71
|
|
|
*/ |
|
72
|
|
|
function lsx_wc_points_message_div_wrapper_class( $message = '', $discount_available ) { |
|
73
|
|
|
if ( '' !== $message ) { |
|
74
|
|
|
$message = str_replace( 'wc_points_redeem_earn_points', 'wc_points_redeem_earn_points woocommerce-message lsx-woocommerce-message-wrap', $message ); |
|
75
|
|
|
} |
|
76
|
|
|
return $message; |
|
77
|
|
|
} |
|
78
|
|
|
add_filter( 'wc_points_rewards_redeem_points_message', 'lsx_wc_points_message_div_wrapper_class', 10, 2 ); |
|
79
|
|
|
} |
|
80
|
|
|
|