=== ShipEdit ===
Contributors: cnrcodetech
Tags: woocommerce, change shipping address, edit order, cancel order, address change, damage claim
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Requires Plugins: woocommerce
Stable tag: 0.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
WC requires at least: 8.0
WC tested up to: 11.2

Let WooCommerce customers change shipping address or cancel before you ship, and report damage after fulfillment from My Account.

== Description ==

A customer types the wrong street, picks an old address, or changes their mind a minute after checkout. Then they email you, and you have to catch the order before it goes out the door. After delivery, a damaged box brings another inbox thread.

ShipEdit lets WooCommerce customers fix shipping mistakes themselves and file a damage claim after the order is fulfilled. After checkout they can edit the order's shipping address or cancel the order, from the order received (thank-you) page or from My Account > View order. You decide how long that window stays open. Once the order is fulfilled, logged-in customers can use Report damage on My Account (and on order-received when they are signed in).

It covers address changes and cancellations before shipping, plus damage claims after fulfillment. No upsells, no product swaps.

= What customers can do =

* Change the shipping address on an order that hasn't shipped yet
* Cancel an unfulfilled order, and see whether a refund was issued or the store will handle it
* Do it from the thank-you page right after checkout, or later from My Account > View order
* See a plain message when a change isn't allowed, such as a PO Box, a country you don't ship to, or a closed edit window
* After fulfillment, report damage from My Account > View order (logged-in customers only). If an open claim already exists for that order, they reopen the same buyer portal link instead of starting a duplicate

= What you control =

* How long after checkout changes are allowed (the edit window)
* Whether address changes, cancellations, or both are turned on
* Optional destination checks: block PO Boxes and APO/FPO/DPO addresses, or only allow countries in your WooCommerce shipping zones
* An email to you when a customer changes an address or cancels, so the packing team knows before the order ships
* An activity log of every change in ShipEdit
* Damage claims under WooCommerce > ShipEdit Claims: list and open claims, change status, start an invite from an order, copy or resend the buyer portal link
* A ShipEdit Claims box on the order edit screen (HPOS and classic) to list that order's claims and start a claim

Changes are written to the WooCommerce order itself, so your shipping plugin, 3PL, or anything else that reads the order sees the new address. Claim photos and status live in ShipEdit; WooCommerce keeps a private order note when a claim is filed.

= Who it's for =

Stores that pack and ship their own orders or use a 3PL, and get "can I change my address?", "please cancel my order", or "it arrived damaged" emails. ShipEdit is also available for Shopify stores.

= How it works =

This plugin is free. It adds the change-address and cancel panel, the Report damage button, and the claims admin screens to your store, and connects them to the ShipEdit service where you set your edit window, rules, and claims plan. Billing happens on shipeditapp.com, not inside WordPress. Setup and pricing for WooCommerce: https://shipeditapp.com/woocommerce-change-shipping-address

Works with block themes and the Order Confirmation block, classic themes, High-Performance Order Storage (HPOS), and the Cart and Checkout blocks.

Damage claims require a ShipEdit plan that includes damage claims. If the store is not entitled, WooCommerce > ShipEdit Claims shows a clear upgrade message and invite actions stay unavailable.

= Guest orders =

Report damage is shown only to logged-in customers who own the order, so WordPress can verify ownership before asking ShipEdit for a portal link. Guest checkout orders do not get the button in this release; merchants can still start a claim invite from WooCommerce > ShipEdit Claims or the order screen.

= External services =

This plugin connects to ShipEdit, a hosted service run by CNR Consulting Services, Inc. Nothing is sent until you enter an API base URL and integration key on the WooCommerce > ShipEdit settings screen.

What is sent and when:

* Order received and My Account view-order pages (only when API settings are saved): the customer's browser loads ShipEdit assets from this plugin and calls your configured API base URL (`/api/woo/order`, `/api/woo/order/address`, `/api/woo/order/cancel`) with the order id, order key, and integration key to check eligibility and submit address changes or cancellations.
* Report damage (logged-in My Account / order-received): the browser calls WordPress admin-ajax only. WordPress verifies the customer owns the order, then ShipEdit's server calls your configured API base URL (`/api/woo/claims/customer-claim-link`) with the store integration key. The integration key is not printed into the claims button markup.
* WooCommerce > ShipEdit Claims and the order Claims box: WordPress calls your configured API base URL (`/api/woo/claims` and related paths) server-to-server with the store integration key to list claims, load detail and signed photo URLs, change status, start invites, and mint or resend buyer portal links. Those calls require the manage_woocommerce capability and WordPress nonces.
* Tools > Export Personal Data / Erase Personal Data: when a request includes an email, WordPress asks ShipEdit (`/api/woo/claims/export-buyer`, `/api/woo/claims/erase-buyer`) for claim records tied to that email on this connected store.
* Admin settings screen: settings stay in WordPress options until you save them. No outbound call is made from the settings page itself.
* Order sync / updates: ShipEdit reads and updates order data through the WooCommerce REST API key and webhooks you authorize from ShipEdit company admin.

ShipEdit privacy policy: https://shipeditapp.com/privacy

The plugin itself is free and GPL-licensed and does not license-gate features inside WordPress. Paid ShipEdit plans (including damage claims) are billed by the service. Support: support@shipeditapp.com.

Guides and setup help: [Change a WooCommerce shipping address before you ship](https://shipeditapp.com/woocommerce-change-shipping-address)

== Privacy ==

ShipEdit may store claim codes, order ids, buyer name and email, claim descriptions, photos, status history, and related messages for damage claims filed through this store. Retention follows the retention setting on your ShipEdit company plan.

This plugin registers WordPress personal data exporters and erasers for ShipEdit claim data tied to a customer email. Export and erase call the ShipEdit API for the connected store only. Address-change and cancel activity that already lives on the WooCommerce order is handled by WooCommerce's own tools.

See https://shipeditapp.com/privacy for the full ShipEdit privacy policy.

== Installation ==

1. In WordPress, go to Plugins > Add New, search for "ShipEdit", then install and activate it. WooCommerce must be active. (You can also upload the zip under Plugins > Add New > Upload Plugin.)
2. Create or open your ShipEdit company at https://shipeditapp.com/company/login and start your plan (include damage claims if you want that feature).
3. In WordPress, go to WooCommerce > Settings > Advanced > REST API and add a key with Read/Write access.
4. In ShipEdit, open WooCommerce and connect your store with its URL and that REST API key.
5. Back in WordPress, open WooCommerce > ShipEdit and paste the API base URL and integration key from ShipEdit.
6. In ShipEdit, set your edit window and choose whether customers can change addresses, cancel orders, or both.
7. Place a test order and leave it unfulfilled. Check that Change address and Cancel order appear on the thank-you page and under My Account > View order.
8. Mark a test order completed, sign in as that customer, and confirm Report damage appears. Merchants can also open WooCommerce > ShipEdit Claims.

== Frequently Asked Questions ==

= Can WooCommerce customers change their shipping address after checkout? =

Not on their own; WooCommerce doesn't offer it. With ShipEdit, customers can edit the shipping address on the thank-you page or under My Account > View order, as long as the order hasn't been fulfilled and is still inside your edit window.

= What happens once an order ships? =

Address change and cancel options disappear. Logged-in customers can use Report damage on completed orders. If they already have an open claim for that order, ShipEdit returns the same buyer portal link instead of creating another claim.

= Can guests report damage? =

Not in this release. Report damage requires a logged-in customer who owns the order so ownership can be checked in WordPress before ShipEdit mints a portal link. Merchants can still invite a claim from WooCommerce > ShipEdit Claims.

= How do merchants manage claims? =

Open WooCommerce > ShipEdit Claims to search claims, open detail (description, photos, timeline), change status, start an invite, and copy or resend the buyer portal link. The order edit screen also has a ShipEdit Claims box.

= Can I block PO Boxes or countries I don't ship to? =

Yes. In ShipEdit Rules you can block PO Boxes and APO/FPO/DPO addresses, and limit new addresses to countries in your WooCommerce shipping zones. The PO Box check looks at the address text, so treat it as a best-effort filter.

= Will I know when a customer changes an order? =

Yes. ShipEdit emails the company owner after an address change or cancellation. If a customer edits the address several times in a few minutes, you get one summary email instead of several. Claim invites can also email the buyer a portal link.

= Does it work with my 3PL or shipping plugin? =

The new address is saved on the WooCommerce order, so anything that reads the order afterwards gets the updated address. If your 3PL has already pulled the order, check with them how they pick up changes.

= Do I need a ShipEdit account? =

Yes. Create a company at https://shipeditapp.com/company/login, connect the store, then paste the API base URL and integration key into WooCommerce > ShipEdit.

= What does it cost? =

The plugin is free. The ShipEdit service is billed on shipeditapp.com. Address/cancel and damage claims depend on the plan you choose there. Nothing is billed inside WordPress. WooCommerce setup help: https://shipeditapp.com/woocommerce-change-shipping-address

= What data is sent to ShipEdit? =

Configured stores send eligibility and update requests from the customer's browser to your API base URL for address/cancel, including order id, order key, and the integration key. Claims admin and Report damage go through WordPress first; WordPress then calls your API base URL with the store integration key. Personal data export/erase for claims also calls ShipEdit. ShipEdit uses the WooCommerce REST API connection you authorize from company admin to read and update orders. See https://shipeditapp.com/privacy.

= Does it work with block themes? =

Yes. It works with block themes, including the Order Confirmation block, and with classic themes. It also supports WooCommerce High-Performance Order Storage (HPOS) and the Cart and Checkout blocks.

= Where can I read the full setup guide? =

The guide at https://shipeditapp.com/woocommerce-change-shipping-address covers setup, edit windows and cancellations.

= Where do I get help? =

Post in this plugin's support forum on WordPress.org, or email support@shipeditapp.com with your store URL.

== Screenshots ==

1. The thank-you page after checkout, with Change address and Cancel order options for an order that hasn't shipped.
2. A customer editing the shipping address on their WooCommerce order.
3. The order page after the new address is saved, showing the updated shipping address.
4. Cancelling an order from My Account > View order, with the refund outcome shown.
5. The WooCommerce > ShipEdit settings screen, where you paste the API base URL and integration key.
6. ShipEdit rules: the edit window, address and cancel toggles, and destination checks.

== Changelog ==

= 0.2.0 =
* Damage claims inside the same ShipEdit plugin (not a separate plugin).
* WooCommerce > ShipEdit Claims: list, detail (description, photos, timeline), status changes, start invite, copy/open/resend buyer portal link.
* ShipEdit Claims box on the order edit screen (HPOS and legacy) with Start claim.
* Report damage for logged-in customers on completed orders (My Account view-order and order-received). Reuses an open claim portal link when one already exists.
* WordPress personal data exporter and eraser for ShipEdit claim data by customer email.
* Server-to-server claims calls use the stored integration key with capability and nonce checks; the key is not exposed in the claims browser UI.
* Respects ShipEdit plan entitlements for damage claims and shows an upgrade message when not entitled.

= 0.1.10 =
* Readme and links update.

= 0.1.9 =
* Added sign-up and settings links so new stores can find ShipEdit company admin.

= 0.1.8 =
* Security: thank-you and My Account panels render only for visitors with the order key, order ownership, or the view_order capability, so order keys are not exposed (including block-theme order-received URLs without ?key=). Guest email fallback fixed for WooCommerce 8.0 to 8.3.
* Cancel panel reports the refund outcome (refund issued, or the store will process it).
* Address changes show the Worker message when ShipEdit blocks them (different shipping zone, PO Box, edit window closed, store auth failure, and similar). Clearer ZIP and state/province validation messages. Storefront errors always show a plain customer sentence (not a raw error code).
* Shop managers can save WooCommerce > ShipEdit settings (options.php capability filter).
* Plugin settings are deleted on uninstall.
* Storefront copy: fixed 0 and 1 minute edit window wording, panel hidden when billing has lapsed, refresh note after an address update.
* Settings page clarifies that the integration key is a store identifier, not a secret.
* Storefront disables save and cancel while a request is in flight; ignores a busy (409) response after a success. Settings page shows the saved notice under WooCommerce > ShipEdit.

= 0.1.7 =
* Set WordPress.org display name and slug to ShipEdit / shipedit.

= 0.1.6 =
* Set Author to CNR Consulting Services, Inc. Plugin URI https://shipeditapp.com; Author URI https://cnrcode.com (WordPress.org ownership clarity).
* Expand WordPress.org readme (external services, FAQ, tags, tested-up-to).
* Declare WooCommerce HPOS and cart/checkout blocks compatibility.
* Align Text Domain to `shipedit`.

= 0.1.5 =
* Prior connector release (thank-you / My Account panels, settings, block confirmation inject).

== Upgrade Notice ==

= 0.2.0 =
Adds damage claims admin, order-screen claims, Report damage for logged-in buyers on completed orders, and WordPress privacy export/erase for claim data. Still one plugin (slug shipedit).

= 0.1.9 =
Added sign-up and settings links so new stores can find ShipEdit company admin.

= 0.1.8 =
Security fix: the storefront panel only renders for authorized visitors. Also adds refund status on cancel and clearer messages when an address change is blocked. Update recommended.

= 0.1.7 =
Display name and directory slug set to ShipEdit. No functional change required after upgrade.

= 0.1.6 =
Author and plugin URI updated for WordPress.org ownership clarity. Adds listing readme details. No functional change required after upgrade.
