Plugin Directory

Changeset 3483751


Ignore:
Timestamp:
03/16/2026 11:12:17 AM (2 weeks ago)
Author:
shipmatedev
Message:

local pickup callback added

Location:
mailplus-shipmate
Files:
8 added
3 edited

Legend:

Unmodified
Added
Removed
  • mailplus-shipmate/trunk/includes/mailplus-shipmate-rest-endpoints.php

    r3451798 r3483751  
    1515        'permission_callback' => '__return_true',
    1616    ) );
    17 
     17   
     18    register_rest_route('mailplus-shipmate/v1', '/orders/is_local_pickup', array(
     19        'methods'  => 'POST',
     20        'callback' => 'mailplus_shipmate_is_local_pickup',
     21        'permission_callback' => '__return_true',
     22    ));
     23   
    1824    register_rest_route('mailplus-shipmate/v1', '/integration/complete', array(
    1925        'methods'  => 'POST',
     
    2632        'callback' => 'mailplus_shipmate_handle_disconnect',
    2733        'permission_callback' => '__return_true',
    28     ));   
     34    )); 
    2935} );
    3036
     
    7379        'success' => true,
    7480        'message' => 'Integration completed successfully',
     81    ), 200);
     82}
     83
     84function mailplus_shipmate_is_local_pickup($order_id) {
     85    $order = wc_get_order( $order_id );
     86    $is_local_pickup = false;
     87
     88    foreach ($order->get_shipping_methods() as $item_id => $item) {
     89        $method_id = $item->get_method_id();
     90        if ($method_id === 'local_pickup') {
     91            $is_local_pickup = true;
     92            break; // Found local pickup, no need to check further
     93        }
     94    }
     95
     96    return new WP_REST_Response(array(
     97        'local_pickup' => $is_local_pickup,
     98        'message' => 'done',
    7599    ), 200);
    76100}
  • mailplus-shipmate/trunk/mailplus-shipmate.php

    r3451798 r3483751  
    33 * Plugin Name: MailPlus Shipmate
    44 * Description: As an Australian shipping service, MailPlus Shipmate integrates MailPlus delivery options with WooCommerce, providing real-time shipping rates and automated parcel management through your MailPlus account.
    5  * Version: 0.1.0
     5 * Version: 0.2.0
    66 * Author: MailPlus
    77 * License: GPL v2 or later
  • mailplus-shipmate/trunk/readme.txt

    r3452838 r3483751  
    55Tested up to: 6.9
    66Requires PHP: 8.2
    7 Stable tag: 0.1.0
     7Stable tag: 0.2.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.