Changeset 3226449
- Timestamp:
- 01/21/2025 06:26:46 PM (13 months ago)
- Location:
- routeapp/trunk
- Files:
-
- 3 edited
-
public/class-routeapp-public.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
routeapp.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
routeapp/trunk/public/class-routeapp-public.php
r3208751 r3226449 802 802 $acceptedCanceledStatuses = get_option('routeapp_cancel_order_statuses') ? get_option('routeapp_cancel_order_statuses') : []; 803 803 804 805 foreach ($order->get_items('fee') as $fee) { 806 if ($fee->get_name() === $this->routeapp_get_insurance_label()) { 807 $insurance_selected = true; 808 $insurance_amount = $fee->get_amount(); 809 if ( class_exists('Automattic\WooCommerce\Utilities\OrderUtil') 810 && OrderUtil::custom_orders_table_usage_is_enabled() ) { 811 // HPOS usage is enabled. 812 $order->update_meta_data('_routeapp_route_charge', $insurance_amount ); 813 $order->update_meta_data('_routeapp_route_protection', $insurance_selected); 814 $order->save(); 815 } else { 816 // Traditional CPT-based orders are in use. 817 update_post_meta( $order->get_id(), '_routeapp_route_charge', $insurance_amount ); 818 update_post_meta( $order->get_id(), '_routeapp_route_protection', $insurance_selected ); 804 $fees = $order->get_items('fee'); 805 if (!empty($fees)) { 806 foreach ($fees as $fee) { 807 if ($fee->get_name() === $this->routeapp_get_insurance_label()) { 808 $insurance_selected = true; 809 $insurance_amount = $fee->get_amount(); 810 if (class_exists('Automattic\WooCommerce\Utilities\OrderUtil') 811 && OrderUtil::custom_orders_table_usage_is_enabled()) { 812 // HPOS usage is enabled. 813 $order->update_meta_data('_routeapp_route_charge', $insurance_amount); 814 $order->update_meta_data('_routeapp_route_protection', $insurance_selected); 815 $order->save(); 816 } else { 817 // Traditional CPT-based orders are in use. 818 update_post_meta($order->get_id(), '_routeapp_route_charge', $insurance_amount); 819 update_post_meta($order->get_id(), '_routeapp_route_protection', $insurance_selected); 820 } 819 821 } 820 822 } 823 } else { 824 try { 825 // Check if WC()->cart exists and is accessible 826 if (class_exists('WC_Cart') && isset(WC()->cart) && WC()->cart instanceof WC_Cart) { 827 // Fallback to WC()->cart->get_fees() if no fees are present in the order 828 $cart_fees = WC()->cart->get_fees(); 829 if (!empty($cart_fees)) { 830 foreach ($cart_fees as $cart_fee) { 831 if ($cart_fee->name === $this->routeapp_get_insurance_label()) { 832 $insurance_selected = true; 833 $insurance_amount = $cart_fee->amount; // Correct method for cart fee amount 834 835 if (class_exists('Automattic\WooCommerce\Utilities\OrderUtil') && 836 OrderUtil::custom_orders_table_usage_is_enabled()) { 837 // HPOS usage is enabled. 838 $order->update_meta_data('_routeapp_route_charge', $insurance_amount); 839 $order->update_meta_data('_routeapp_route_protection', $insurance_selected); 840 $order->save(); 841 } else { 842 // Traditional CPT-based orders are in use. 843 update_post_meta($order->get_id(), '_routeapp_route_charge', $insurance_amount); 844 update_post_meta($order->get_id(), '_routeapp_route_protection', $insurance_selected); 845 } 846 } 847 } 848 } 849 } 850 } catch (Exception $e) { 851 // Log the exception and ensure the application flow continues 852 error_log("An error occurred while processing cart fees: " . $e->getMessage()); 853 } 854 821 855 } 822 856 823 857 if ( class_exists('Automattic\WooCommerce\Utilities\OrderUtil') 824 858 && OrderUtil::custom_orders_table_usage_is_enabled() ) { -
routeapp/trunk/readme.txt
r3208751 r3226449 6 6 Requires at least: 4.0 7 7 Tested up to: 6.7.1 8 Stable tag: 2.2.2 28 Stable tag: 2.2.23 9 9 Requires PHP: 5.6 10 10 License: GPLv2 or later … … 106 106 107 107 == Changelog == 108 = 2.2.23 = 109 * Display correctly route fee amount in orders admin view 110 108 111 = 2.2.22 = 109 112 * Fix problem for astracker shipment tracking compatibility -
routeapp/trunk/routeapp.php
r3208751 r3226449 10 10 * Plugin URI: https://route.com/for-merchants/ 11 11 * Description: Route allows shoppers to insure their orders with one-click during checkout, adding a layer of 3rd party trust while improving the customer shopping experience. 12 * Version: 2.2.2 212 * Version: 2.2.23 13 13 * Author: Route 14 14 * Author URI: https://route.com/ … … 26 26 * Currently plugin version. 27 27 */ 28 define( 'ROUTEAPP_VERSION', '2.2.2 2' );28 define( 'ROUTEAPP_VERSION', '2.2.23' ); 29 29 30 30 /**
Note: See TracChangeset
for help on using the changeset viewer.