=== Demfilz Returns and Warranty Claims for WooCommerce ===
Contributors: demfilz
Tags: returns, rma, warranty, refunds, woocommerce
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Customers request returns and warranty claims from their account, with photos and messages. Resolve each one with a refund or a replacement order.

== Description ==

Returns and warranty claims usually arrive by email: no record of which items, photos scattered across inboxes, no status for the customer, and refunds keyed in by hand. This plugin gives each claim a number, a page and a history, and turns the outcome into a proper WooCommerce refund or a replacement order.

= For customers =

* A **Returns** tab in My Account lists their claims and the orders they can still claim on.
* A **Request a return or warranty claim** button on each eligible order.
* A simple form: which items and how many, the reason, what is wrong, what they would like (refund, replacement or repair) and photos.
* Each claim has its own page with its status, the store's return instructions once approved, and a message thread with photos.
* Customers without an account use the **Returns and warranty** page: they enter their order number and email address and receive a link by email. Nothing about the order is shown on screen.
* A pending claim can be withdrawn.

= For the store =

* **WooCommerce > Returns** lists every claim with status filters, search and bulk status changes. The menu shows how many claims wait for review.
* The claim screen shows the items against the order (ordered, refunded, line totals), the reason and details, photos, and the full thread. Reply to the customer, or add a private note only staff see, and change the status in the same step.
* **Refund items** creates a WooCommerce refund for the claimed lines including tax. It is capped at what is still refundable on each line, can put the items back in stock, and can refund through the payment gateway when you tick the box (off by default). A second click cannot refund twice.
* **Create replacement order** makes a no-charge order for the claimed items, on hold and ready to ship, linked back to the claim. The customer is not sent a separate order email.
* Log a claim taken by phone or email from the order screen.
* Statuses: pending review, approved, item received, completed, declined, cancelled. Every change is added to the order notes.

= Rules you control =

* Which order statuses can be claimed (completed by default).
* The return period in days and the warranty period in months, with a warranty setting on each product: store default, a set length, no time limit, or no warranty claims.
* What happens after a period ends: refuse the claim, or accept it marked "Late" for review. Your obligations under the consumer law that applies to your store may last longer than the periods you set, so accepting late claims for review is the safer choice.
* Your own list of reasons for returns and for warranty claims.
* Which resolutions customers can ask for.
* Photos off, optional, required for warranty claims, or required for every claim, with limits on number and size.
* Return instructions shown once a claim is approved.
* A link to your returns policy on the form.

= Emails =

Five emails, all editable in WooCommerce > Settings > Emails like WooCommerce's own: new claim (to the store), customer replied (to the store), claim received, claim updated, and the return link for customers without an account.

= Photos stay private =

Photos are saved in a private folder under a random name and re-saved through WordPress's image editor, which drops the location and device details cameras add. They are shown only to store staff and to the customer who owns the claim.

= Privacy =

The plugin adds its data to the WordPress personal data export and erase tools. Erasing removes the name, email address, details, the customer's messages and the photos, and keeps what was claimed and how it was resolved for the store's records. Suggested text for your privacy policy is added under Settings > Privacy.

= For developers =

Actions: `drwc_claim_created`, `drwc_claim_status_changed`, `drwc_claim_message_added`, `drwc_claim_refunded`, `drwc_replacement_created`.
Filters: `drwc_reasons`, `drwc_resolutions`, `drwc_claimable_qty`, `drwc_order_eligible`, `drwc_claim_number`, `drwc_lookup_order_id`, `drwc_replacement_order_status`, `drwc_account_endpoint`, `drwc_limiter_ip`, `drwc_max_requests`.
Email templates can be copied to `yourtheme/woocommerce/emails/`.

== Installation ==

1. Install and activate WooCommerce.
2. Upload the plugin through Plugins > Add New, or unzip it into `wp-content/plugins`, and activate it.
3. Go to WooCommerce > Returns > Settings and set your periods, reasons and return instructions.
4. The plugin creates a "Returns and warranty" page for customers without an account. Add it to your menu or footer.

== Frequently Asked Questions ==

= How much of an item can a customer claim? =

What they ordered, less what has been refunded, less what is in their other open claims. A completed claim that was refunded here no longer counts, because the refund itself lowers the line.

= Does the refund send money back? =

Only when you tick "Refund the money through" the payment method, and only for gateways that support refunds. Otherwise the refund is recorded on the order and you pay the money back yourself, the same as a manual refund in WooCommerce.

= Can I charge a restocking fee? =

Yes. Lower the refund amount. It is spread across the claimed lines in proportion.

= What happens to stock? =

Refunds put the items back in stock when "Put the items back in stock" is ticked. A replacement order reduces stock like any order when it is created.

= My accounting plugin syncs orders. What about replacement orders? =

A replacement order is a normal WooCommerce order with a total of zero, created with `created_via` set to `drwc_replacement` and the meta `_drwc_claim_id`. Sync plugins treat it like any other order, so it reaches your books as a zero-value sale when they sync it.

= Can customers without an account make a claim? =

Yes, when "Guests" is on. They enter their order number and email address on the Returns and warranty page. If they match an order that can be claimed, a link valid for 48 hours is emailed to the address on the order. The page always shows the same message, so it cannot be used to find out whether an order exists.

= Does it work with the block checkout and HPOS? =

Yes. It declares compatibility with High-Performance Order Storage and the cart and checkout blocks.

= Is there a shortcode? =

`[drwc_returns]` shows the order lookup for guests and the customer's claims when they are logged in. The page created on activation already holds it.

== Screenshots ==

1. A claim in WooCommerce > Returns: items, photos, messages, status and resolution.
2. The claims list with status filters.
3. The claim form in My Account.
4. A claim's page in My Account, with the message thread.
5. The settings.
6. The warranty setting on a product.

== Changelog ==

= 1.0.0 =
* First release.

== Upgrade Notice ==

= 1.0.0 =
First release.
