=== eShip - Shipping Quotes for WooCommerce ===
Contributors: juanmaleal
Tags: woocommerce, shipping, quotes, courier, labels
Requires at least: 6.9
Tested up to: 7.1
Stable tag: 2.1.5
Requires PHP: 7.4.0
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Real-time shipping rates and label management via eShip API for WooCommerce.

**Important! An eShip account with an active plan is required. [Subscribe here](https://myeship.co/#pricing)**

== Description ==

eShip connects your WooCommerce store to the eShip API, enabling real-time shipping rate calculation directly at checkout. Your customers see accurate quotes from multiple carriers, and you manage everything from your WordPress admin.

= Discounted rates =

Access preferential shipping rates by integrating your carrier accounts or use eShip's own special rates (available in select regions).

Supported carriers include:

* FedEx
* DHL
* USPS
* UPS
* NZ Post
* Estafeta
* Redpack
* Moova
* Mensajeros Urbanos
* 99 minutos
* Segmail Express (Mexico City)
* and more

= Key features =

* **Real-time quotes** — Shipping rates calculated live via eShip API at cart and checkout.
* **Custom store address** — Set a different origin address for shipping calculations, independent of your WooCommerce store settings.
* **Automatic display** — Quotes appear automatically on cart and checkout pages.
* **Test mode** — Sandbox credentials for safe testing before going live.
* **Automatic shipping labels** — When the customer completes the purchase, the shipping label (guía) is generated automatically using the selected carrier and service, and the tracking number is saved to the order.
* **Multilingual** — Available in Spanish and English.
* **HPOS compatible** — Declares compatibility with WooCommerce High-Performance Order Storage.

= Getting started =

1. Install and activate the plugin.
2. Go to **eShip > Dashboard** in your WordPress admin.
3. Enter your API credentials (Production or Test mode).
4. Configure your store address or set a custom shipping address.
5. **Important:** Go to **WooCommerce > Settings > Shipping > Shipping Zones** and add the **eShip Shipping** method to at least one zone. Without this step, shipping quotes will not appear at checkout.
6. Configure default dimensions and weight in the Quoter settings.

== Installation ==

= Automatic Installation =

1. Log in to your WordPress dashboard.
2. Go to **Plugins > Add New**.
3. Search for "eShip".
4. Click **Install Now** and then **Activate**.

= Manual Installation =

1. Download the plugin ZIP file.
2. Go to **Plugins > Add New > Upload Plugin**.
3. Choose the ZIP file and click **Install Now**.
4. Activate the plugin.

= Post-Installation Setup =

1. Go to **eShip > Dashboard** in your admin menu.
2. Fill in your API Key (Production) or API Key (Test) from [myeship.co](https://myeship.co/).
3. Toggle Test Mode if using sandbox credentials.
4. Configure your store address or enable **Custom Address for Shipping**. Use ISO 2-letter country codes (e.g., MX, US, CO) in the Country field.
5. **Important:** Go to **WooCommerce > Settings > Shipping > Shipping Zones** and add the **eShip Shipping** method to at least one zone. Without this step, shipping quotes will not appear at checkout.
6. Go to **eShip > Cotizador** to set default package dimensions and weight.

== Frequently Asked Questions ==

= Do I need an eShip account? =

Yes. Create your account and get your API keys at [myeship.co](https://myeship.co/).

= Is WooCommerce required? =

Yes. eShip requires WooCommerce to be installed and active.

= Can I test before going live? =

Yes. Enable **Test Mode** in eShip > Dashboard and use your sandbox API key.

= Can I use a different address for shipping quotes? =

Yes. Enable "Use custom address for quoter" in the dashboard and fill in your shipping origin.

= What if my products have no weight? =

eShip uses a default weight (configurable in eShip > Cotizador) for products without a defined weight.

= Is HPOS (High-Performance Order Storage) supported? =

Yes. eShip declares full compatibility with WooCommerce HPOS.

= Why are shipping rates not showing at checkout? =

Make sure you have added the **eShip Shipping** method to at least one shipping zone in **WooCommerce > Settings > Shipping > Shipping Zones**. This is required for quotes to appear.

= Where can I get support? =

Contact us at support@segmail.co or visit [myeship.co](https://myeship.co/).

== Screenshots ==

1. **Dashboard Overview** — Main dashboard with configuration status and progress.
2. **API Settings** — Enter production or test API keys and verify connection.
3. **Store Address** — View store address and configure custom shipping origin.
4. **Shipping Zones** — Manage WooCommerce shipping zones with eShip method.
5. **Quoter Settings** — Configure default dimensions, weight, and measurement units.

_Note: add the corresponding `screenshot-1.png` … `screenshot-5.png` files to the plugin root before submitting to WordPress.org._

== Changelog ==

= 2.1.5 =
* Fix: removed the duplicate checkout refresh triggered by eShip; WooCommerce and Elementor now handle shipping updates natively without duplicate AJAX requests.

= 2.1.4 =
* Fix: the AJAX quoter (cart/booking widget) now also sends ISO two-letter country/state codes (e.g. `MX` / `SON`) and uses the store address when the custom address is incomplete, matching the checkout fix and avoiding quotation errors.

= 2.1.3 =
* Fix: the quotation payload always sends a valid sender (origin) address and ISO two-letter country/state codes (e.g. `MX` / `SON`). The custom store address is only used when fully configured; otherwise the WooCommerce store address is used. This fixes API errors like `DESTINATION.POSTALCODE.MISSING.ORINVALID` that could break the checkout / payment methods.
* Fix: the destination always includes the country code (ISO) when available, removing the "destination zip code is invalid" rejections.

= 2.1.2 =
* Fix: stable/deterministic shipping rate IDs so checkout shipping methods reload correctly and prices refresh (fixes the WooCommerce `checkout.js` `getElementById(...).focus()` TypeError that blocked price updates).
* Fix: eShip quotation now tolerates `rates` nested under `data` and logs the real API error messages for easier troubleshooting.

= 2.1.1 =
* Fix: auto-generated labels now use the exact carrier/service selected by the customer (never substituting with another courier).
* Fix: the label generated at checkout preserves the selected carrier when the original rate is still valid, and only re-quotes (with the real WooCommerce order number) as a fallback.
* Fix: the shipping origin always uses the configured store/custom address (no more wrong origin code on the label).
* Fix: the WooCommerce order number (order_num) is now registered on the label via the re-quotation.
* Fix: shipping items sent to the eShip quotation now include the correct product data (SKU, description, price, weight, currency, store_id).
* Security: escape dynamic data in frontend/quoter JavaScript to prevent potential XSS.
* Remove IDE metadata (.idea) from the plugin package.

= 2.1.0 =
* Automatic shipping label (guía) generation at checkout using the carrier/service selected by the customer.
* Shipping labels generated automatically on order completion, with tracking number saved to the order and shown to the customer.
* Admin metabox to view, download and regenerate shipping labels (PDF / PDF 4x6 / ZPL) per order.
* Security and translation (i18n) improvements; labels on shipped orders reflect the exact selected carrier.

= 2.0.0 =
* Initial release for WordPress.org
* Real-time shipping quotes via eShip API
* Custom store address support
* WooCommerce shipping zones integration
* Dashboard with API, store, and shipping status
* Test mode for sandbox testing
* Multilingual support (Spanish / English)
* HPOS compatibility declared
* Quoter with configurable default dimensions and weight
* Automatic label generation at checkout using the customer's selected carrier/service, with tracking number saved to the order and shown to the customer

== Upgrade Notice ==

= 2.0.0 =
Initial release. Configure your API credentials and shipping zones after installation.
