Changeset 3305056
- Timestamp:
- 06/02/2025 01:19:51 PM (10 months ago)
- Location:
- woot-ro/trunk
- Files:
-
- 4 edited
-
README.txt (modified) (3 diffs)
-
includes/class-woot-woocommerce.php (modified) (4 diffs)
-
public/class-woot-public.php (modified) (1 diff)
-
woot.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woot-ro/trunk/README.txt
r3305044 r3305056 3 3 Tags: shipping, couriers, delivery, romania, ecommerce 4 4 Requires at least: 4.0 5 Tested up to: 6. 6.26 Stable tag: 2.0. 65 Tested up to: 6.8.1 6 Stable tag: 2.0.7 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 77 77 * Fix warning when checking for existing shipping method 78 78 79 = 2.0.7 = 80 * Fix: Prevent null warnings when accessing chosen shipping method in checkout flow 81 79 82 == Upgrade Notice == 80 83 … … 103 106 = 2.0.6 = 104 107 * Fix warning when checking for existing shipping method 108 109 = 2.0.7 = 110 * Fix: Prevent null warnings when accessing chosen shipping method in checkout flow -
woot-ro/trunk/includes/class-woot-woocommerce.php
r3153925 r3305056 41 41 if ($enabled && (is_cart() || is_checkout())) { 42 42 $shipping_methods = WC()->session->get('chosen_shipping_methods'); 43 $shipping_method = explode(':', $shipping_methods[0]); 44 45 if (!empty($shipping_method[0])) { 46 $settings = get_option('woocommerce_' . $shipping_method[0] . '_' . $shipping_method[1] . '_settings'); 47 48 if (!empty($settings['couriers'])) { 49 $couriers = $settings['couriers']; 50 51 $this->couriers = array_values(array_filter($this->couriers, function ($row) use ($couriers) { 52 return in_array($row['uid'], $couriers); 53 })); 43 44 if (is_array($shipping_methods) && !empty($shipping_methods[0])) { 45 $shipping_method_parts = explode(':', $shipping_methods[0]); 46 47 if (!empty($shipping_method_parts[0]) && !empty($shipping_method_parts[1])) { 48 $settings = get_option('woocommerce_' . $shipping_method_parts[0] . '_' . $shipping_method_parts[1] . '_settings'); 49 50 if (!empty($settings['couriers'])) { 51 $couriers = $settings['couriers']; 52 53 $this->couriers = array_values(array_filter($this->couriers, function ($row) use ($couriers) { 54 return in_array($row['uid'], $couriers); 55 })); 56 } 54 57 } 55 58 } 56 59 } 60 57 61 58 62 return $this->couriers; … … 277 281 if (is_checkout()) { 278 282 $shipping_methods = WC()->session->get('chosen_shipping_methods'); 279 $shipping_method = explode(':', $shipping_methods[0]); 280 281 if (!empty($shipping_method)) { 282 if ($shipping_method[0] === 'woot_locations') { 283 284 if (is_array($shipping_methods) && !empty($shipping_methods[0])) { 285 $shipping_method = explode(':', $shipping_methods[0]); 286 287 if (!empty($shipping_method) && isset($shipping_method[0]) && $shipping_method[0] === 'woot_locations') { 283 288 echo '<tr class="woocommerce-wt-locations">'; 284 289 echo '<th></th>'; … … 308 313 { 309 314 $shipping_methods = WC()->session->get('chosen_shipping_methods'); 310 $shipping_method = explode(':', $shipping_methods[0]); 311 312 if ($shipping_method[0] === 'woot_locations' && empty($_POST['location_id'])) { 313 wc_add_notice(__('Please select a location!'), 'error'); 315 316 if (is_array($shipping_methods) && !empty($shipping_methods[0])) { 317 $shipping_method = explode(':', $shipping_methods[0]); 318 319 if (isset($shipping_method[0]) && $shipping_method[0] === 'woot_locations' && empty($_POST['location_id'])) { 320 wc_add_notice(__('Please select a location!'), 'error'); 321 } 314 322 } 315 323 } … … 363 371 { 364 372 if (is_checkout()) { 365 $shipping = WC()->session->get('chosen_shipping_methods'); 366 $shipping = explode(':', $shipping[0]); 367 368 if (!empty($shipping[0])) { 369 $shipping_settings = get_option('woocommerce_' . $shipping[0] . '_' . $shipping[1] . '_settings'); 370 $payment_id = WC()->session->get('chosen_payment_method'); 371 372 if (!empty($shipping_settings[$payment_id . '_' . 'price'])) { 373 $gateways = WC_Payment_Gateways::instance(); 374 $payment = $gateways->payment_gateways()[$payment_id]; 375 376 $cart->add_fee($payment->title, $shipping_settings[$payment_id . '_' . 'price'], !empty($cart->get_shipping_tax())); 373 $chosen_shipping_methods = WC()->session->get('chosen_shipping_methods'); 374 375 if (is_array($chosen_shipping_methods) && !empty($chosen_shipping_methods[0])) { 376 $shipping_parts = explode(':', $chosen_shipping_methods[0]); 377 378 if (!empty($shipping_parts[0]) && !empty($shipping_parts[1])) { 379 $shipping_settings = get_option('woocommerce_' . $shipping_parts[0] . '_' . $shipping_parts[1] . '_settings'); 380 $payment_id = WC()->session->get('chosen_payment_method'); 381 382 if (!empty($shipping_settings[$payment_id . '_price'])) { 383 $gateways = WC_Payment_Gateways::instance(); 384 $payment = $gateways->payment_gateways()[$payment_id] ?? null; 385 386 if ($payment) { 387 $cart->add_fee($payment->title, $shipping_settings[$payment_id . '_price'], !empty($cart->get_shipping_tax())); 388 } 389 } 377 390 } 378 391 } -
woot-ro/trunk/public/class-woot-public.php
r3305044 r3305056 130 130 131 131 $shipping_methods = WC()->session->get('chosen_shipping_methods'); 132 $shipping_method = explode(':', $shipping_methods[0]);133 132 134 if (is set($shipping_method[0]) && isset($shipping_method[1])) {135 $s ettings = get_option('woocommerce_' . $shipping_method[0] . '_' . $shipping_method[1] . '_settings');133 if (is_array($shipping_methods) && !empty($shipping_methods[0])) { 134 $shipping_method_parts = explode(':', $shipping_methods[0]); 136 135 137 if (!empty($settings['couriers'])) { 138 $couriers = $settings['couriers']; 136 if (isset($shipping_method_parts[0], $shipping_method_parts[1])) { 137 $settings = get_option('woocommerce_' . $shipping_method_parts[0] . '_' . $shipping_method_parts[1] . '_settings'); 138 139 if (!empty($settings['couriers'])) { 140 $couriers = $settings['couriers']; 141 } 139 142 } 140 143 } -
woot-ro/trunk/woot.php
r3305044 r3305056 17 17 * Plugin URI: https://woot.ro 18 18 * Description: Integrates all popular couriers in Romania, providing a one-stop solution for all your delivery needs 19 * Version: 2.0. 619 * Version: 2.0.7 20 20 * Author: Woot.ro 21 21 * Author URI: https://woot.ro … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define('WOOT_VERSION', '2.0. 6');38 define('WOOT_VERSION', '2.0.7'); 39 39 40 40 /**
Note: See TracChangeset
for help on using the changeset viewer.