PluginProbe
Sendy / 3.4.7
Sendy v3.4.7
3.4.6 3.4.7 trunk 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 All 32 releases
sendy / lib / ShippingMethods / PickupPointDelivery.php

PickupPointDelivery.php in Sendy 3.4.7, at lib/ShippingMethods/PickupPointDelivery.php

60 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Sendy\WooCommerce\ShippingMethods;
4
5 use WC_Shipping_Flat_Rate;
6
7 class PickupPointDelivery extends WC_Shipping_Flat_Rate
8 {
9 use ShippingMethodTrait {
10 ShippingMethodTrait::instance_form_fields as trait_instance_form_fields;
11 }
12
13 public const ID = 'sendy_pickup_point';
14
15 public function __construct($instance_id = 0)
16 {
17 $this->id = self::ID;
18 $this->instance_id = absint($instance_id);
19 $this->method_title = __('Sendy - Pickup Point Delivery', 'sendy');
20 $this->method_description = __('Let your customers choose a pick-up point', 'sendy');
21
22 $this->supports = [
23 'shipping-zones',
24 'instance-settings',
25 'instance-settings-modal',
26 ];
27
28 $this->init();
29 $this->init_form_fields();
30 $this->init_settings();
31
32 add_filter('woocommerce_shipping_instance_form_fields_' . $this->id, [$this, 'instance_form_fields'], 10, 1);
33 add_action('woocommerce_update_options_shipping_' . $this->id, [$this, 'process_admin_options']);
34 }
35
36 /**
37 * @param array<string,array<string,mixed>> $form_fields
38 * @return array<string,array<string,mixed>>
39 */
40 public function instance_form_fields(array $form_fields): array
41 {
42 $form_fields = $this->trait_instance_form_fields($form_fields);
43
44 $form_fields['carrier'] = [
45 'title' => __('Carrier', 'sendy'),
46 'type' => 'select',
47 'options' => [
48 'DHL' => 'DHL eCommerce',
49 'PostNL' => 'PostNL',
50 'DPD' => 'DPD',
51 ],
52 'class' => 'wc-enhanced-select',
53 'default' => 'class',
54 'description' => __('Select which carrier to show the pickup points for', 'sendy'),
55 ];
56
57 return $form_fields;
58 }
59 }
60