=== Order Tracking Notification for WooCommerce ===
Contributors: aisimpleplugin
Tags: tracking, tracking notification, woocommerce tracking, order tracking, email tracking
Requires at least: 6.0
Tested up to: 6.9
WC tested up to: 10.7
Requires PHP: 7.2
Stable tag: 1.5.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A lightweight WooCommerce shipment tracking plugin for Canada. Add a tracking number and carrier to WooCommerce orders.

== Description ==

**Order Tracking Notification** is a super lightweight WooCommerce plugin designed to let store owners quickly add a *tracking number* and *carrier* directly to an WooCommerce order.  
The tracking information is then automatically added to all customer emails (including "Order Completed") with a clickable tracking link.

No complex setup.  
No APIs required.  
No heavy UI.  

Just simple, fast, clean shipment tracking built for Canadian stores.

== Key Features ==

- Add tracking number + carrier to any WooCommerce order  
- Supported carriers: **Canada Post, UPS, Purolator, GLS, Canpar, Delivro, Nationex, Loomis**  
- Tracking automatically appears in customer emails  
- Clickable tracking link to the carrier website  
- Compatible with both **HPOS** and **legacy** WooCommerce order storage  
- Lightweight — no external services, no scripts, no performance impact 
- Complete integration with **Machool**: automatically added tracking number and carrier in the WooCommerce email


== Ultra-light plugin ==

This plugin adds **zero bloat** to your store.  
One clean UI in the WooCommerce order edit page, and automatic email integration.

Perfect for stores that need quick, reliable tracking without subscribing to complex or expensive shipment tracking solutions.

---

== Screenshots ==

1. Setting page
2. Tracking fields inside WooCommerce order edit screen  
3. Tracking information in customer emails  
4. Carrier selection and tracking input (simple and clean UI)


---

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/aisp-simple-tracking/`
2. Activate the plugin through the **Plugins** menu in WordPress
3. Edit any WooCommerce order
4. Find the **Order Tracking Notification** meta box
5. Choose your carrier and enter your tracking number
6. Save the order — tracking info will automatically appear in the customer emails

---

== Frequently Asked Questions ==

= Does this plugin support HPOS? =  
Yes! The plugin is compatible with both WooCommerce HPOS and Legacy order storage.

= Where do I enter the tracking number? =  
Go to **WooCommerce → Orders → Edit Order**.  
You will see the meta box **Order Tracking Notification** with a carrier selector and tracking field.

= Will customers see the tracking number? =  
Yes. The plugin automatically inserts tracking information in all customer-facing WooCommerce emails.

= Which carriers are supported? =  
- Canada Post  
- Purolator  
- GLS  
- Canpar  
- UPS
- Loomis
- Nationex
- Delivro

---

== Changelog ==

= 1.5.0 =
* Improved: Centralized all meta keys (carrier, tracking, boxes) as constants in the Helpers class to avoid duplication across files.
* Fixed: Moved Settings and Webhook init() calls inside the plugins_loaded hook to ensure WooCommerce is fully loaded before initialization.
* Fixed: Removed duplicate init() call at the bottom of the Settings and Webhook class files.
* Fixed: Applied wp_kses_post() on the final output string in the email class instead of on the translation string before variable substitution.
* Security: Added REST API args validation and sanitization (absint on order_id, sanitize_text_field on tracking_number and carrier).
* Improved: Removed unused meta key properties from the Email and Orders Column classes.
* Improved: Refactored the orders column output using a cleaner PHP/HTML structure.
* Improved: Code formatting and consistency in the Settings class.
* Improved: Added admin notice feedback after saving settings and after generating or regenerating the API key.
* Improved: Added inline documentation for backward compatibility with existing filters.

= 1.4.4 =
* Fixed: fatal error in REST API webhook due to incorrect helper class and method reference.
* Fixed: webhook stability when processing tracking updates.
* Improved: box quantity is now optional and only used when manually entered.
* Improved: simplified tracking settings by removing the need for a global box option.

= 1.4.3 =
* Added: Centralized tracking data retrieval via helper function for improved consistency.
* Improved: Reduced code duplication across admin, emails, and order list.
* Improved: Better normalization of carrier names for reliable tracking URLs.
* Improved: Fallback handling when tracking URL is not available.
* Fixed: Potential undefined variable issues in tracking display logic.
* Fixed: Data consistency between admin panel, emails, and orders column.

= 1.4.2 =
* Improved: Security by properly escaping translated strings and dynamic data.
* Improved: Tracking link output in emails for better reliability and safety.

= 1.4.1 =
* Added: Carrier normalization for improved tracking detection.
* Improved: Tracking display consistency across emails, admin, and order list.
* Improved: Manual tracking now properly overrides external data.
* Fixed: Issues with carrier mapping and missing tracking in order list.
* Fixed: Duplicate carrier entries in admin selector.

= 1.4.0 =
* Added: Support for Machool tracking meta (shipping_provider / tracking_number).

= 1.3.0 =
* Added: Tracking column in the WooCommerce orders list.
* Added: Display of carrier name, tracking number, and number of boxes directly in the orders table.
* Improved: Tracking number is now clickable and opens the carrier tracking page in a new tab.
* Improved: Compatibility with both legacy orders screen and the new WooCommerce Orders interface (HPOS).
* Improved: Admin usability by displaying tracking information without opening the order.


= 1.2.1 =
* Improved: internationalization and escaping in email settings. 

= 1.2.0 =
* Added: New “Number of boxes” field in the order admin panel. The field is admin-only and is not visible to customers.

= 1.1.0 =
* Added: Clickable tracking link in the order admin screen when a carrier and tracking number are provided.

= 1.0.1 =
* Fixed: Tracking links for Nationex and Canada Post

= 1.0.0 =
* Initial release


---

== Upgrade Notice ==

= 1.5.0 =
This update improves plugin stability and maintainability with internal refactoring, better security for the REST API, and improved admin experience. No action required.

= 1.4.4 =
This update fixes a fatal error in the REST API webhook and improves tracking settings behavior.

= 1.4.0 = 
This update add full integration with Machool and Ogalo

= 1.3.0 =
This update adds a new Tracking column to the WooCommerce orders list, showing carrier name, clickable tracking number, and box count directly in the admin. Fully compatible with the new WooCommerce Orders screen and HPOS. No action required after update.

= 1.2.0 =
This update introduces a new “Number of boxes” field in the WooCommerce order admin screen.

= 1.1.0 =
Added: Clickable tracking link in the order admin screen when a carrier and tracking number are provided.

= 1.0.0 =
Initial stable release of AISP Order Tracking Notification.

