=== FactuPress - Default Customer Payment Method ===
Contributors: jairoochoa, dixitalmedia, factupress
Tags: woocommerce, payment method, checkout, orders, my account
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.1
WC requires at least: 6.0.0
WC tested up to: 10.0.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Set a default payment method per customer and preselect it when creating manual orders in the admin and at checkout.

== Description ==

**FactuPress - Default Customer Payment Method** lets you fix a preferred payment gateway for each customer and reuses it in two places, saving clicks and avoiding mistakes:

* **Manual orders in the admin.** When you pick a customer while creating or editing an order in `Orders`, their default payment method is preselected automatically, on both the classic and the HPOS (high-performance order storage) order screens.
* **Checkout.** If the customer's preferred gateway is currently available, it comes preselected for them at checkout — classic checkout and the Cart & Checkout blocks are both supported.

The default can be set from two places:

1. **The customer's profile** (`Users → Edit User`), by any user who can edit users. This list always matches the gateways WooCommerce itself would offer on the manual order screen (active gateways only, same "Other" fallback).
2. **My Account**, by the customer themselves — only if the store owner allows it via a new setting under `WooCommerce → Settings → Accounts & Privacy → Customer choice`. Off by default.

= Why this plugin =

Stores that create a lot of orders manually from the admin (phone orders, in-person sales, B2B accounts with a fixed payment method) end up picking the same payment gateway for the same customer over and over. This plugin removes that repetitive step, and optionally lets recurring customers speed up their own checkout the same way.

= Requirements =

This plugin requires WooCommerce to be active. It does nothing on sites without WooCommerce, and shows an admin notice if WooCommerce is deactivated while this plugin remains active.

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/factupress-default-customer-payment-method` directory, or install the plugin through the WordPress plugins screen directly.
2. Activate the plugin through the "Plugins" screen in WordPress.
3. Make sure WooCommerce is installed and active.
4. Go to a customer's profile (`Users → Edit User`) to set their default payment method, or enable customer self-service under `WooCommerce → Settings → Accounts & Privacy → Customer choice`.

== Frequently Asked Questions ==

= Does this work with High-Performance Order Storage (HPOS)? =

Yes. The plugin declares HPOS compatibility and the manual-order autofill works on both the classic (`post.php`) and the HPOS (`admin.php?page=wc-orders`) order screens.

= Does this work with the Cart & Checkout blocks, or only the classic checkout? =

Both. The classic checkout and the Store API used by the Cart & Checkout blocks read the same WooCommerce session key to decide which payment method is preselected, so a single mechanism covers both.

= What happens if the customer's preferred gateway gets disabled later? =

It's simply ignored wherever it would apply (manual order autofill, checkout preselection) until it's enabled again or a new default is chosen. Nothing breaks.

= Does this collect any data or call any external service? =

No. Everything is stored locally as WordPress user meta and a single option; no external requests are made by this plugin.

== Screenshots ==

1. Default payment method selector on the customer's profile in the admin.
2. "Customer choice" setting under WooCommerce → Settings → Accounts & Privacy.
3. Default payment method selector in My Account (only visible when customer choice is enabled).

== Changelog ==

= 1.0.0 =
* Initial release: default payment method per customer, admin profile selector, optional My Account selector, manual-order autofill (classic and HPOS), checkout preselection (classic and blocks).

== Upgrade Notice ==

= 1.0.0 =
Initial release.
