# Doozy Order Protection

A simple yet powerful WordPress/WooCommerce plugin that adds order protection to your store. Allow customers to protect their orders against loss, theft, or damage during shipping.

## Features

- ✅ Add protection checkbox to cart and checkout pages
- ✅ Configurable protection fee (default: $2.99)
- ✅ Clean, modern UI that matches your theme
- ✅ Compatible with both Classic and Block themes
- ✅ Compatible with WooCommerce block-based checkout
- ✅ AJAX-powered for seamless cart updates
- ✅ Simple admin settings page
- ✅ Follows WordPress and WooCommerce coding standards
- ✅ Translation ready
- ✅ No external dependencies

## Requirements

- WordPress 5.8 or higher
- WooCommerce 5.0 or higher
- PHP 7.4 or higher

## Installation

### Manual Installation

1. Download the plugin files
2. Upload the `doozy-order-protection` folder to `/wp-content/plugins/`
3. Activate the plugin through the 'Plugins' menu in WordPress
4. Go to **Doozy Protection** in the WordPress admin menu to configure settings

### Via WordPress Admin

1. Go to Plugins > Add New
2. Click "Upload Plugin"
3. Choose the downloaded ZIP file
4. Click "Install Now"
5. Activate the plugin

## Configuration

After activation, go to **Doozy Protection** in your WordPress admin menu to configure:

- **Enable Protection**: Toggle protection functionality on/off
- **Protection Label**: Customize the text shown to customers (default: "Doozy Order Protection")
- **Protection Fee**: Set the amount charged for protection (default: $2.99)
- **Default Checked**: Choose whether the checkbox is checked by default

## How It Works

1. **Cart & Checkout**: A checkbox appears on the cart and checkout pages
2. **Customer Choice**: Customers can opt-in to add protection to their order
3. **Fee Addition**: When checked, the protection fee is added to the order total
4. **Order Tracking**: Protection status is saved with the order for reference

## Theme Compatibility

### Classic Themes
The plugin uses standard WooCommerce hooks to display the protection checkbox:
- `woocommerce_cart_totals_before_order_total` for cart page
- `woocommerce_review_order_before_order_total` for checkout page

### Block Themes (FSE)
Full compatibility with WordPress Full Site Editing and WooCommerce block-based checkout.

## Developer Information

### Hooks & Filters

The plugin provides several hooks for customization:

```php
// Modify protection fee amount
add_filter('doozy_order_protection_fee_amount', function($amount) {
    return 3.99; // Custom amount
});

// Modify protection label
add_filter('doozy_order_protection_fee_name', function($name) {
    return 'Premium Shipping Protection';
});
```

### File Structure

```
doozy-order-protection/
├── admin/
│   ├── class-doozy-order-protection-admin.php
│   ├── css/
│   │   └── doozy-order-protection-admin.css
│   └── js/
│       └── doozy-order-protection-admin.js
├── includes/
│   ├── class-doozy-order-protection.php
│   ├── class-doozy-order-protection-loader.php
│   └── class-doozy-order-protection-woocommerce.php
├── public/
│   ├── class-doozy-order-protection-public.php
│   ├── css/
│   │   └── doozy-order-protection-public.css
│   └── js/
│       └── doozy-order-protection-public.js
├── doozy-order-protection.php
├── uninstall.php
└── README.md
```

### Class Structure

- **Doozy_Order_Protection**: Core plugin class that initializes everything
- **Doozy_Order_Protection_Loader**: Manages hooks and filters registration
- **Doozy_Order_Protection_Admin**: Handles admin functionality and settings page
- **Doozy_Order_Protection_Public**: Manages public-facing assets
- **Doozy_Order_Protection_WooCommerce**: Contains all WooCommerce integration logic

## Frequently Asked Questions

### Can I change the protection fee amount?

Yes! Go to **Doozy Protection** in your WordPress admin and update the "Protection Fee" field.

### Does it work with block themes?

Yes! The plugin is fully compatible with both classic and block themes, including WooCommerce's block-based checkout.

### Will it slow down my site?

No. The plugin is lightweight and only loads necessary assets on cart and checkout pages.

### Can I customize the appearance?

Yes. You can add custom CSS to override the default styles. The main wrapper class is `.doozy-order-protection-wrapper`.

### Does it work with multi-currency plugins?

The protection fee will be displayed in your store's currency. For multi-currency support, the fee will need to be converted by your currency plugin.

### What happens when I uninstall?

The plugin cleanly removes all its settings. Order metadata is preserved for historical records unless you uncomment the cleanup code in `uninstall.php`.

## Changelog

### 1.0.0 - 2026-01-05
* Initial release
* Cart and checkout integration
* Admin settings page
* Classic and block theme support
* WooCommerce block checkout support

## Support

For support, please contact Doozy at [support@doozyorderprotection.com](mailto:support@doozyorderprotection.com)

## License

This plugin is licensed under the GPL v2 or later.

```
Doozy Order Protection
Copyright (C) 2026 Doozy

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
```

## Credits

Developed by Doozy - https://doozyorderprotection.com

