feat: Add Shipping API controller

Created backend API for fetching WooCommerce shipping zones.

New Files:
- includes/Api/ShippingController.php

Features:
 GET /settings/shipping/zones endpoint
 Fetches all WooCommerce shipping zones
 Includes shipping methods for each zone
 Handles "Rest of the World" zone (zone 0)
 Returns formatted region names
 Returns method costs (Free, Calculated, or price)
 Permission check: manage_woocommerce

Data Structure:
- id: Zone ID
- name: Zone name
- order: Display order
- regions: Comma-separated region names
- rates: Array of shipping methods
  - id: Method instance ID
  - name: Method title
  - price: Formatted price or "Free"/"Calculated"
  - enabled: Boolean

Integration:
- Registered in Routes.php
- Uses WC_Shipping_Zones API
- Compatible with all WooCommerce shipping methods
This commit is contained in:
dwindown
2025-11-08 21:27:34 +07:00
parent e8b4421950
commit bc7206f1cc
2 changed files with 158 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ use WooNooW\Api\AnalyticsController;
use WooNooW\Api\AuthController;
use WooNooW\API\PaymentsController;
use WooNooW\API\StoreController;
use WooNooW\Api\ShippingController;
class Routes {
public static function init() {
@@ -49,6 +50,10 @@ class Routes {
// Store controller
$store_controller = new StoreController();
$store_controller->register_routes();
// Shipping controller
$shipping_controller = new ShippingController();
$shipping_controller->register_routes();
});
}
}