Changeset 3452273
- Timestamp:
- 02/02/2026 05:08:18 PM (3 weeks ago)
- Location:
- routeapp/trunk
- Files:
-
- 3 edited
-
public/class-routeapp-public.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
routeapp.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
routeapp/trunk/public/class-routeapp-public.php
r3448191 r3452273 952 952 953 953 //MSS-6533: Add local pickup flag and excluded shipping methods meta data to the order 954 $updated |= $this->updateRouteOrderMetaData( $order, $is_hpos, '_routeapp_order_local_pickup', 955 !$this->routeapp_is_shipping_method_allowed(false, $order) ? 1 : 0); 954 $updated |= $this->updateRouteOrderMetaData( $order, $is_hpos,'_routeapp_order_local_pickup', $this->routeapp_resolve_local_pickup_flag( $order ) ); 956 955 $updated |= $this->updateRouteOrderMetaData( $order, $is_hpos, '_routeapp_excluded_shipping_methods', $this->routeapp_get_excluded_shipping_methods()); 957 956 … … 1776 1775 } 1777 1776 1777 //MSS-6533 1778 /** 1779 * Resolve the local pickup flag in a FAIL-SAFE way. 1780 * 1781 * Priority: 1782 * 1. Order shipping items 1783 * 3. Checkout session (fallback only) 1784 * 1785 * @param WC_Order|null $order 1786 * 1787 * @return int 1 = local pickup, 0 = not local pickup 1788 */ 1789 public function routeapp_resolve_local_pickup_flag( WC_Order $order = null): int { 1790 $excluded_methods = $this->routeapp_get_excluded_shipping_methods(); 1791 if ( empty( $excluded_methods ) || ! is_array( $excluded_methods ) ) { 1792 return 0; 1793 } 1794 1795 // Order-based (most reliable). 1796 if ( $order instanceof WC_Order ) { 1797 $shipping_items = $order->get_shipping_methods(); 1798 if ( ! empty( $shipping_items ) ) { 1799 foreach ( $shipping_items as $shipping_item ) { 1800 if ( ! $shipping_item instanceof WC_Order_Item_Shipping ) { 1801 continue; 1802 } 1803 $method_id = $shipping_item->get_method_id(); 1804 if ( empty( $method_id ) ) { 1805 continue; 1806 } 1807 $method_id = explode( ':', $method_id )[0]; 1808 if ( in_array( $method_id, $excluded_methods, true ) ) { 1809 return 1; 1810 } 1811 } 1812 return 0; 1813 } 1814 } 1815 1816 // Session fallback (checkout only). 1817 if ( ! function_exists( 'WC' ) || ! WC()->session ) { 1818 return 0; 1819 } 1820 $chosen = WC()->session->get( 'chosen_shipping_methods' ); 1821 $packages = WC()->session->get( 'shipping_for_package_0' ); 1822 if ( empty( $chosen[0] ) || empty( $packages['rates'] ) ) { 1823 return 0; 1824 } 1825 $chosen_id = $chosen[0]; 1826 if ( ! isset( $packages['rates'][ $chosen_id ] ) ) { 1827 return 0; 1828 } 1829 $method_id = explode( ':', $packages['rates'][ $chosen_id ]->id )[0]; 1830 if ( in_array( $method_id, $excluded_methods, true ) ) { 1831 return 1; 1832 } 1833 1834 return 0; 1835 } 1836 1837 1778 1838 } 1779 1839 -
routeapp/trunk/readme.txt
r3448191 r3452273 6 6 Requires at least: 4.0 7 7 Tested up to: 6.7.1 8 Stable tag: 2.2.3 58 Stable tag: 2.2.36 9 9 Requires PHP: 5.6 10 10 License: GPLv2 or later … … 106 106 107 107 == Changelog == 108 109 = 2.2.36 = 110 * Fix local pickup flag resolution and prevent false positives 108 111 109 112 = 2.2.35 = -
routeapp/trunk/routeapp.php
r3448191 r3452273 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.3 512 * Version: 2.2.36 13 13 * Author: Route 14 14 * Author URI: https://route.com/ … … 26 26 * Currently plugin version. 27 27 */ 28 define( 'ROUTEAPP_VERSION', '2.2.3 5' );28 define( 'ROUTEAPP_VERSION', '2.2.36' ); 29 29 30 30 /**
Note: See TracChangeset
for help on using the changeset viewer.