=== COD Express Checkout ===
Contributors: oughoudane
Donate link: https://buymeacoffee.com/adiloug
Tags: woocommerce, checkout, cod, cash on delivery, express checkout
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.0
WC requires at least: 8.0
WC tested up to: 9.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add a customizable one-click COD checkout form to product pages. Skip cart, skip checkout, more sales.

== Description ==

**COD Express Checkout** adds a streamlined, one-click checkout form directly beneath the product price on WooCommerce single product pages. This form appears **only when Cash on Delivery (COD) is enabled** as a payment method, allowing customers to bypass the traditional cart → checkout flow entirely.

= Perfect for COD-Heavy Markets =

Cash on Delivery dominates in specific regions:

* **Middle East**: 60-80% of e-commerce transactions are COD
* **South Asia** (India, Pakistan, Bangladesh): 50-70% COD preference
* **Southeast Asia**: 40-60% COD usage
* **Latin America**: Growing COD adoption

= Key Features =

* ⚡ **Express Checkout Form** - Displays directly on product page
* 🎯 **COD-Specific** - Only shows when COD payment is enabled
* 📱 **Mobile Optimized** - Responsive design for all devices
* ⚙️ **Fully Configurable** - Toggle fields, customize labels, reorder fields
* 🔄 **Variable Products** - Full support for variable products with variations
* 📝 **Order Notes** - Optional customer notes field
* 🔒 **Secure** - Nonce verification, input sanitization, rate limiting
* 🌐 **Translation Ready** - Full i18n support
* 🎨 **Theme Agnostic** - Works with any WordPress theme
* 🔗 **Developer Friendly** - Extensive hooks and filters
* 📍 **Shortcode Support** - Place the form anywhere on your site

= How It Works =

1. Customer lands on a product page
2. Sees the express checkout form below the price
3. For variable products, selects their preferred variation
4. Fills in name, phone, and address
5. Clicks "Order Now - Pay on Delivery"
6. Order is created instantly via AJAX
7. Customer sees confirmation message

No cart page. No checkout page. Just one form, one click!

= Conversion Benefits =

* **Reduce cart abandonment** by 50%+
* **Capture impulse buyers** at peak buying intent
* **Decrease checkout time** from 3-5 minutes to under 60 seconds
* **Improve mobile conversion rates** with simplified flow

== Installation ==

= Automatic Installation =

1. Log in to your WordPress admin panel
2. Go to Plugins → Add New
3. Search for "COD Express Checkout"
4. Click "Install Now" and then "Activate"

= Manual Installation =

1. Download the plugin zip file
2. Log in to your WordPress admin panel
3. Go to Plugins → Add New → Upload Plugin
4. Choose the zip file and click "Install Now"
5. Activate the plugin

= Configuration =

1. Ensure WooCommerce is installed and activated
2. Enable Cash on Delivery payment method (WooCommerce → Settings → Payments → Cash on Delivery)
3. Go to WooCommerce → COD Express to configure the plugin
4. Customize fields, button text, and colors as needed

== Frequently Asked Questions ==

= Does this plugin require WooCommerce? =

Yes, COD Express Checkout requires WooCommerce 8.0 or higher to function.

= Will the form show for all payment methods? =

No, the express checkout form only displays when the Cash on Delivery (COD) payment method is enabled in WooCommerce.

= Does it work with variable products? =

Yes! The plugin fully supports variable products. Customers can select their preferred variation (size, color, etc.) and the form automatically captures the correct variation and price.

= Can I customize which fields are shown? =

Yes! Go to WooCommerce → COD Express and you can:
* Enable/disable each field
* Mark fields as required or optional
* Customize field labels
* Reorder fields via drag-and-drop

= Is it compatible with my theme? =

COD Express Checkout is designed to be theme-agnostic and should work with any properly coded WordPress theme. The form inherits your theme's styling while maintaining its own layout.

= Can I override the form template? =

Yes! Copy the template file from:
`plugins/cod-express-checkout/templates/express-checkout-form.php`
to:
`yourtheme/cod-express-checkout/express-checkout-form.php`
and customize as needed.

= How do I translate the plugin? =

The plugin is fully translation-ready. Use any translation plugin like Loco Translate, or add translations to:
`wp-content/languages/plugins/cod-express-checkout-{locale}.mo`

= Is it GDPR compliant? =

Yes. The plugin:
* Does not send data to external servers
* Uses WooCommerce's standard order storage
* Provides cleanup on uninstall
* Collects only necessary information

= Can I place the form anywhere on my site? =

Yes! Use the shortcode to place the express checkout form on any page, post, or widget area:

[cod_express_checkout product_id="123"]

**Parameters:**
* `product_id` - (Required if not on product page) The WooCommerce product ID
* `button_text` - (Optional) Override the button text

**Examples:**
[cod_express_checkout product_id="123"]
[cod_express_checkout product_id="123" button_text="Buy Now!"]

This works with any page builder (Elementor, Gutenberg, Divi, etc.) - just add a shortcode widget/block!

= Can developers extend this plugin? =

Yes! The plugin provides numerous hooks and filters:

**Actions:**
* `cod_express_checkout_before_form`
* `cod_express_checkout_after_form`
* `cod_express_checkout_before_order_create`
* `cod_express_checkout_after_order_create`

**Filters:**
* `cod_express_checkout_enabled_fields`
* `cod_express_checkout_button_text`
* `cod_express_checkout_order_status`

== Screenshots ==

1. Express checkout form on product page
2. Admin settings - General configuration
3. Admin settings - Field configuration with drag-and-drop
4. Mobile responsive view

== Changelog ==

= 1.0.0 =
* Initial release
* Express checkout form on product pages
* Simple and variable product support
* Admin settings panel
* Field configuration (enable/disable, required, labels, order)
* Order notes field
* AJAX order creation
* Rate limiting for security
* Translation ready
* HPOS compatibility
* Shortcode support [cod_express_checkout] for placing form anywhere

== Upgrade Notice ==

= 1.0.0 =
Initial release of COD Express Checkout. Install to reduce cart abandonment on COD orders!

== Developer Documentation ==

= Available Hooks =

**Actions:**

`cod_express_checkout_loaded` - Fires after plugin is fully loaded
`cod_express_checkout_before_form` - Before form renders
`cod_express_checkout_after_form` - After form renders
`cod_express_checkout_before_order_create` - Before order creation
`cod_express_checkout_after_order_create` - After order creation
`cod_express_checkout_emails_sent` - After order emails sent

**Filters:**

`cod_express_checkout_enabled_fields` - Modify enabled fields
`cod_express_checkout_button_text` - Change button text
`cod_express_checkout_form_title` - Change form title
`cod_express_checkout_order_status` - Set order status (default: processing)
`cod_express_checkout_billing_address` - Modify billing address
`cod_express_checkout_shipping_address` - Modify shipping address
`cod_express_checkout_rate_limit` - Adjust rate limit (default: 5 per minute)

= Example: Add Custom Field =

`
add_filter( 'cod_express_checkout_available_fields', function( $fields ) {
    $fields['custom_field'] = array(
        'label'    => __( 'Custom Field', 'your-textdomain' ),
        'type'     => 'text',
        'default'  => false,
        'required' => false,
    );
    return $fields;
});
`

= Example: Change Order Status =

`
add_filter( 'cod_express_checkout_order_status', function( $status, $order ) {
    return 'on-hold'; // Instead of 'processing'
}, 10, 2 );
`

= Example: Add Custom Validation =

`
add_action( 'cod_express_checkout_validate_input', function( $data ) {
    if ( strlen( $data['billing_phone'] ) < 10 ) {
        throw new Exception( __( 'Phone number must be at least 10 digits.', 'your-textdomain' ) );
    }
});
`

== Requirements ==

* WordPress 6.0 or higher
* WooCommerce 8.0 or higher
* PHP 7.4 or higher
* Cash on Delivery payment method enabled

== Support ==

For support, please:

1. Check the FAQ section above
2. Visit the [WordPress.org support forum](https://wordpress.org/support/plugin/cod-express-checkout/)
3. Report bugs or request features on the support forum

== Privacy Policy ==

COD Express Checkout respects your privacy:

* No data is sent to external servers
* All order data is stored in your WooCommerce database
* The plugin uses WooCommerce's native order system
* On uninstall, all plugin settings are removed (order data is preserved)

== Credits ==

* Developed by [oughoudane](https://vizify.ca)
* Built with love for COD-heavy markets
* Uses WooCommerce APIs for native integration
* Icons from WordPress Dashicons
