=== WPC FieldCraft - Checkout Field Editor for WooCommerce ===
Contributors: wpclever
Donate link: https://wpclever.net
Tags: woocommerce, checkout, checkout field, field editor, custom field
Requires at least: 5.9
Tested up to: 7.1
Stable tag: 1.1.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Edit WooCommerce checkout fields: add, remove, reorder, conditional logic, dynamic pricing, custom sections & drag-and-drop builder.

== Description ==

WPC FieldCraft lets you customize the WooCommerce checkout page. Add new custom fields, edit default fields, remove unnecessary ones, and rearrange them with a drag-and-drop interface — no coding required.

The plugin also includes conditional logic, dynamic pricing, custom sections, and field templates.

= Key Features =

* Drag-and-drop field reordering for Billing, Shipping, and Additional fields
* 20+ field types: Text, Textarea, Select, Radio, Checkbox, Multi-checkbox, Date, Time, DateTime, Date Range, Color Picker, Number, Email, URL, Password, Paragraph, and more
* Conditional logic: Show or hide fields based on payment method, shipping method, country, cart contents, and other field values
* Dynamic pricing: Add fees for any field (fixed amount)
* Custom sections: Create new checkout sections at any position on the page
* Field templates: Pre-built sets you can apply in one click
* Import/Export: Migrate checkout configurations between sites via JSON
* Full Block Checkout (Checkout Block) compatibility
* Translation ready

== ✏️ Field Types ==

The plugin supports a variety of field types to collect the data you need.

**Input Fields**
* Text, Textarea, Number, Email, URL, Password — standard inputs with full validation
* Select, Radio Button, Checkbox, Multi-checkbox — single and multiple choice options with customizable choices
* Paragraph — display-only elements for adding instructions or visual separators

**Advanced Pickers**
* Date Picker, Time Picker, DateTime Picker — with a built-in datepicker UI
* Date Range Picker — let customers select check-in/check-out dates, rental periods, etc.
* Color Picker — visual color selection with a native color input

== 🧠 Conditional Logic ==

Show or hide fields dynamically based on the customer's selections and checkout context. Checkout forms update in real time as customers make selections.

**Supported Conditions**
* Payment Method — Show fields only for specific gateways (e.g., show "Bank Reference" only for Bank Transfer)
* Shipping Method — Display fields based on chosen shipping (e.g., show "Delivery Instructions" only for Local Delivery)
* Billing/Shipping Country — Target fields to specific countries or regions
* Other Checkout Fields — Chain fields together (e.g., show "Company VAT" only when "Customer Type" is "Business")

**Logic Controls**
* AND / OR relation — combine multiple conditions with "All must match" or "Any can match"
* Show When / Hide When — choose the action when conditions are met
* Equal / Not Equal comparison — flexible matching with wildcard support

== 💰 Dynamic Pricing & Fees ==

Automatically add fees to the order based on customer selections. Useful for gift wrapping, rush processing, insurance, and other value-added services.

**Pricing Types**
* **Fixed Amount** — Add a flat fee (e.g., $5 for gift wrapping)

All fees are automatically displayed in the WooCommerce order review, emails, and admin order detail — with full tax support.

== 📂 Custom Checkout Sections ==

Go beyond the standard Billing/Shipping/Additional layout. Create new checkout sections and position them at the locations listed below.

**Available Positions**
* Before/After Customer Details
* Before/After Billing Form
* Before/After Shipping Form
* Before/After Registration Form
* Before/After Order Notes
* Before/After Terms & Conditions
* Before/After Submit Button

Each section gets its own field editor tab, drag-and-drop ordering, and conditional logic — just like the built-in sections.

== 📋 Field Templates ==

Get started quickly with pre-built field sets covering common checkout scenarios.

* **Gift & Personalization** — Gift wrapping checkbox, gift message, recipient name
* **Business / B2B** — Company name, VAT number, purchase order number
* **Delivery Preferences** — Preferred date, time slot, delivery instructions
* **Additional Info** — "How did you hear about us?", special requests, order notes

Apply any template with one click. Templates merge with your existing fields — they never overwrite.

== 📦 Import / Export ==

Easily migrate checkout configurations between staging and production environments.

* Export all field configurations as a JSON file
* Import configurations from another site
* Useful for development workflows and multi-site management

== 🔒 Security ==

Built with WordPress security best practices:

* Nonce verification on all AJAX endpoints
* Capability checks (`manage_woocommerce`) on all admin operations

== 💡 Common Use Cases ==

Below are real-world scenarios store owners commonly solve with this plugin.

= Personalization & Gifting =

**1. Gift wrapping with fee**
Add a "Gift Wrap" checkbox field with a $5 fixed fee. When checked, show a "Gift Message" textarea — the fee is automatically added to the order total.

**2. Personalized products**
Add fields for "Name to Print", "Font Style" (select), and "Color" (color picker) — all shown conditionally when "Add Personalization" checkbox is checked.

= B2B & Business =

**3. Business checkout fields**
Show "Company Name", "VAT Number", and "Purchase Order Number" only when "Customer Type" radio is set to "Business". Hide them for personal orders.

**4. Delivery date and time slot**
Add a date picker for preferred delivery date and a select dropdown for time slots (Morning, Afternoon, Evening). Show only for "Local Delivery" shipping method.

**5. Delivery instructions for specific methods**
Show a "Delivery Instructions" textarea only when the customer selects "Local Delivery" or "Same Day" shipping. Hide it for standard and express shipping.

**6. Signature requirement for high-value orders**
Add a "Require Signature" checkbox with a $3 fee, shown conditionally when cart total exceeds $200.

= Marketing & Feedback =

**7. Referral tracking**
Add a "How did you hear about us?" select field with options like Google, Facebook, Friend Referral, etc. Data is saved to order meta for analytics.

**8. Special requests**
Add a textarea for special requests, positioned in a custom section before the submit button with a heading "Anything else we should know?".

= Country-Specific Fields =

**9. CPF for Brazil**
Show a "CPF" text field only when billing country is Brazil. Mark it as required.

**10. GSTIN for India**
Show "GSTIN Number" only when billing country is India and customer type is "Business".

= Combining Conditional Logic =

Multiple conditions can be combined for more specific use cases:

* **"Show gift options only for physical products shipped domestically"** — Combine: Shipping Method = Flat Rate AND Shipping Country = US
* **"Business fields for EU customers only"** — Combine: Customer Type = Business AND Billing Country = any EU country
* **"Rush processing fee only for express shipping"** — Combine: Shipping Method = Express AND add a $15 fixed fee checkbox

== Installation ==

1. Download the plugin from WordPress.org.
2. Go to Plugins > Add New > Upload Plugin and choose the downloaded file.
3. Click "Install Now" and then "Activate".
4. Navigate to **Checkout Fields** to start customizing your checkout fields.

== Changelog ==

= 1.1.0 =
* Updated: Optimized the code
* Updated: Compatible with WP 7.1 & Woo 11.2

= 1.0.2 =
* Updated: Changed plugin description in readme.txt

= 1.0.1 =
* Updated: Changed plugin name to "FieldCraft for WooCommerce"

= 1.0.0 =
* Initial release
