get_instance_id(); if ( empty( $instance_id ) ) { continue; } $key = $method->id . ':' . $instance_id; $list[ $key ] = $method->get_title(); } } $default_zone = new WC_Shipping_Zone( 0 ); foreach ( $default_zone->get_shipping_methods() as $method ) { if ( ! is_a( $method, 'WC_Shipping_Method' ) ) { continue; } $instance_id = $method->get_instance_id(); if ( empty( $instance_id ) ) { continue; } $key = $method->id . ':' . $instance_id; $list[ $key ] = $method->get_title(); } return $list; } public static function is_pickup_order( WC_Order $order ) { $pickup_methods = (array) get_option( self::PICKUP_METHODS_OPTION, [] ); if ( empty( $pickup_methods ) ) { return false; } foreach ( $order->get_shipping_methods() as $shipping ) { $key = $shipping->get_method_id() . ':' . $shipping->get_instance_id(); if ( in_array( $key, $pickup_methods, true ) ) { return true; } } return false; } public static function render_page() { $api_key = get_option( self::OPTION_KEY ); $pickup_methods = (array) get_option( self::PICKUP_METHODS_OPTION, [] ); $cleanup_on_uninstall = (bool) get_option( self::UNINSTALL_CLEANUP_OPTION, false ); $methods = self::get_shipping_methods_list(); $has_valid_nonce = isset( $_GET['_wpnonce'] ) && wp_verify_nonce( sanitize_key( $_GET['_wpnonce'] ), 'aisp_otn_feedback' ); if ( $has_valid_nonce && isset( $_GET['updated'] ) ) { echo '

'; esc_html_e( 'Settings saved.', 'aisp-order-tracking-notification' ); echo '

'; } if ( $has_valid_nonce && isset( $_GET['key_generated'] ) ) { echo '

'; esc_html_e( 'API key generated successfully.', 'aisp-order-tracking-notification' ); echo '

'; } ?>