/** * Plugin Name: WooCommerce Custom API - Orders and Customers by Phone * Plugin URI: https://example.com * Description: Adds custom WooCommerce REST API endpoints under wc-custom-api/v1 to search customers and orders by billing phone. * Version: 1.0 * Author: Tofa * License: GPL2 * Text Domain: woo-commerce-custom-api-phone */ if (!defined('ABSPATH')) { exit; // Exit if accessed directly } add_action('rest_api_init', function () { // Custom endpoint: Search Customers by Phone register_rest_route('wc-custom-api/v1', '/customers-by-phone', [ 'methods' => 'GET', 'callback' => 'wc_custom_api_search_customers_by_phone', 'permission_callback' => '__return_true', 'args' => [ 'phone' => [ 'required' => true, 'validate_callback' => function ($param) { return is_string($param) && strlen($param) > 3; } ] ] ]); // Custom endpoint: Search Orders by Phone register_rest_route('wc-custom-api/v1', '/orders-by-phone', [ 'methods' => 'GET', 'callback' => 'wc_custom_api_search_orders_by_phone', 'permission_callback' => '__return_true', 'args' => [ 'phone' => [ 'required' => true, 'validate_callback' => function ($param) { return is_string($param) && strlen($param) > 3; } ] ] ]); }); // Custom function to search customers by phone function wc_custom_api_search_customers_by_phone($request) { $phone = sanitize_text_field($request->get_param('phone')); $args = [ 'meta_query' => [ [ 'key' => 'billing_phone', 'value' => $phone, 'compare' => 'LIKE', ] ] ]; $users = get_users($args); $data = []; foreach ($users as $user) { $data[] = [ 'id' => $user->ID, // Return only the customer ID ]; } if (empty($data)) { return rest_ensure_response(['message' => 'No customers found.']); } return rest_ensure_response($data); } // Custom function to search orders by phone function wc_custom_api_search_orders_by_phone($request) { $phone = sanitize_text_field($request->get_param('phone')); $args = [ 'limit' => -1, 'status' => 'any', 'meta_query' => [ [ 'key' => '_billing_phone', 'value' => $phone, 'compare' => 'LIKE', ] ] ]; $orders = wc_get_orders($args); $data = []; foreach ($orders as $order) { $data[] = [ 'order_id' => $order->get_id(), // Return only the order ID 'customer_id' => $order->get_customer_id(), // Return only the customer ID ]; } if (empty($data)) { return rest_ensure_response(['message' => 'No orders found.']); } return rest_ensure_response($data); } Sorrento SR 894 C2 Cat-Eye Havana Eyeglasses For Women - Luxotix
Home delivery, all over Bangladesh
Previous
Sorrento SR 902 C5 Oval Eyeglasses For Women

Sorrento SR 902 C5 Oval Eyeglasses For Women

2,250 
Next

Sorrento SR866 C3 Oval Eyeglasses For Women

2,000 
Sorrento SR866 C3 Oval Eyeglasses For Women

Sorrento SR 894 C2 Cat-Eye Havana Eyeglasses For Women

2,250 

Sorrento SR 894 C2 Cat-Eye Havana Eyeglasses. All the women can wear this eyeglasses.

Choose Lens
SKU: SR_894_C2 Categories: , , , , Brands: , Frame Shape: Frame Types: Frame Material:
Trust Badge Image

Description

Description of Sorrento SR 894 C2 Cat-Eye Havana Eyeglasses For Women:

Frame Materials: Acetate
Lens Width: 53 mm
Nose Width: 15 mm
Temple/Leg: 140 mm
Frame Height: 44 mm
Total Frame Width: 131 mm
Weight: 22 gram
In the box: Sorrento SR 894 C2 Cat-Eye Eyeglasses, Luxurious Protective Box, Wiper


**Lens’ prices are for SPH power upto -6.00 and CYL power upto -2.0

**High-Power Lens/Progressive Lens/Complex Power will cost higher
**EMI facilities available for all eligible credit card holders.
**Minimum Purchase amount 5,000/=

**COD not available for Outside Dhaka.
Disclaimer: The actual product’s color may slightly vary due to photographic lighting sources or your device’s display settings.

Copyright © 2023 luxotix All rights reserved.

Shopping cart

1

Subtotal: 21,768 

View cartCheckout

Change