PluginProbe ʕ •ᴥ•ʔ
PiWeb Delivery & Pickup Date Time for WooCommerce / 3.0.49.3
PiWeb Delivery & Pickup Date Time for WooCommerce v3.0.49.3
3.0.63 3.0.62 3.0.61 3.0.60 3.0.49.49 3.0.49.6 3.0.49.60 3.0.49.61 3.0.49.62 3.0.49.63 3.0.49.64 3.0.49.66 3.0.49.67 3.0.49.69 3.0.49.7 3.0.49.70 3.0.49.72 3.0.49.73 3.0.49.74 3.0.49.76 3.0.49.77 3.0.49.79 3.0.49.9 3.0.49.90 3.0.49.91 3.0.49.92 3.0.49.93 3.0.49.94 3.0.49.96 3.0.49.97 3.0.49.99 trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 2.9.17 3.0.47 3.0.49 3.0.49.1 3.0.49.10 3.0.49.11 3.0.49.12 3.0.49.13 3.0.49.16 3.0.49.17 3.0.49.19 3.0.49.2 3.0.49.20 3.0.49.21 3.0.49.22 3.0.49.23 3.0.49.24 3.0.49.26 3.0.49.27 3.0.49.29 3.0.49.3 3.0.49.30 3.0.49.31 3.0.49.32 3.0.49.33 3.0.49.34 3.0.49.36 3.0.49.37 3.0.49.39 3.0.49.4 3.0.49.40 3.0.49.41 3.0.49.42 3.0.49.43 3.0.49.44 3.0.49.46 3.0.49.47
pi-woocommerce-order-date-time-and-type / public / class-woo-app.php
pi-woocommerce-order-date-time-and-type / public Last commit date
css 2 years ago js 2 years ago class-css.php 2 years ago class-date.php 2 years ago class-delivery-type.php 2 years ago class-display-field.php 2 years ago class-js.php 2 years ago class-main.php 2 years ago class-order.php 2 years ago class-pickup-location.php 2 years ago class-shipping-method.php 2 years ago class-time-range.php 2 years ago class-time-slot.php 2 years ago class-time.php 2 years ago class-validate.php 2 years ago class-woo-app.php 2 years ago
class-woo-app.php
61 lines
1 <?php
2
3 class pisol_dtt_woo_mobile_app_support{
4
5 protected $post_type = 'shop_order';
6
7 function __construct(){
8 $add_to_order_note = pisol_dtt_get_setting('pi_enable_woocommerce_app_support', 0);
9
10 if(empty($add_to_order_note)) return;
11
12 add_action( 'woocommerce_checkout_update_order_meta', [$this,'addDataInNote'], PHP_INT_MAX, 1 );
13
14 add_action( 'save_post', array($this,'savePostTimeSlot'), PHP_INT_MAX, 2 );
15 }
16
17 function savePostTimeSlot( $post_id, $post ){
18
19 if(!apply_filters( 'pisol_dtt_order_note_on_edit', true )) return;
20
21 if ( ( empty( $post_id ) || empty( $post ) || ( $this->post_type !== get_post_type( $post ) ) )
22 || ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id )
23 || ( ! current_user_can( 'edit_post', $post_id ) ) ) {
24 return;
25 }
26
27
28 $this->addDataInNote( $post_id );
29 }
30
31 function addDataInNote( $order_id ){
32 $order = wc_get_order($order_id);
33
34 $type = $order->get_meta( 'pi_delivery_type', true ); // delivery type 'delivery' or 'pickup'
35
36 $date = $order->get_meta( 'pi_system_delivery_date', true ); // date in yyyy/mm/dd format
37 if(class_exists('pi_dtt_date')){
38 $date = pi_dtt_date::translatedDate($date);
39 }
40
41 $time = $order->get_meta( 'pi_delivery_time', true ); // delivery time
42 if(class_exists("pisol_dtt_time")){
43 $time = pisol_dtt_time::formatTimeForDisplay($time);
44 }
45
46 $location = $order->get_meta( 'pickup_location', true ); // pickup location
47
48 $note = __('Delivery Type:', 'pisol-dtt').' '.$type;
49 $note .= '<br>'.__('Data:','pisol-dtt').' '.$date;
50 $note .= '<br>'.__('Time:','pisol-dtt').' '.$time;
51 if(!empty($location)){
52 $note .= '<br>'.__('Location:','pisol-dtt').' '.$location;
53 }
54
55 $note = apply_filters('pisol_dtt_order_note_filter', $note, $order);
56
57 $order->add_order_note( $note );
58 }
59
60 }
61 new pisol_dtt_woo_mobile_app_support();