=== Yeekit Checkout Field Blocks for WooCommerce ===
Contributors: addonsorg
Donate link: https://add-ons.org/
Tags: woocommerce, checkout fields, checkout block, custom fields, acf checkout
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.2.1
WC requires at least: 8.0
WC tested up to: 10.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Custom fields for WooCommerce Checkout Block: File Upload, Digital Signature, Color Swatches, Date/Time, Slider, and 19+ drag-and-drop blocks.

== Description ==

Advanced Checkout Fields Block empowers store owners to easily customize and extend the modern block-based WooCommerce Checkout with 19+ visual, interactive custom field blocks.

Designed natively for the **WooCommerce Checkout Block (Gutenberg)**, **Cart Block**, and fully compatible with **High-Performance Order Storage (HPOS)**, this plugin lets you collect any additional information you need from customers before they place their order—without touching a single line of code.

### Why Choose Yeekit Checkout Field Blocks?

* **Visual Gutenberg Block Experience**: Simply drag and drop custom fields directly into your Checkout template in the Site Editor or Page Editor.
* **19+ Powerful Field Types**: From simple text and dropdowns to advanced File Uploads, Digital Signatures, and Picture Tiles.
* **100% HPOS & Store API Ready**: Seamlessly integrated with WooCommerce Store API and High-Performance Order Storage (Custom Order Tables).
* **Order Management & Admin Review**: All custom field values, uploaded files, and customer signatures are neatly displayed in the WooCommerce Admin Order details screen.
* **Customer Facing Display**: Values appear on the Order Received (Thank You) page, Customer Account View Order page, and customer notification emails.
* **WooCommerce Order Email Attachments**: Automatically attach customer uploaded files and digital signatures directly to admin and customer order confirmation emails.
* **Flexible Column Layouts**: Customize field widths (Full Width 100%, Half Width 50%, One-Third 33%) to build beautiful multi-column checkout layouts.
* **Classic Checkout Fallback**: Automatically renders fields for standard classic checkout shortcode `[woocommerce_checkout]` when needed.

---

### Available Field Blocks (19+ Field Types)

1. **Text**: Standard single-line text input for PO numbers, gift notes, names, or custom IDs.
2. **Textarea**: Multi-line textarea for delivery instructions, greetings, or extra details.
3. **Email**: Email field with format validation and optional customer auto-fill.
4. **Phone**: Phone number input with format checking.
5. **Number**: Numeric input with min, max, and step controls.
6. **Password**: Secure masked password or PIN code input.
7. **URL**: Web address field with URL validation.
8. **Select**: Customizable dropdown with custom key-value options.
9. **Checkbox**: Single or multiple checkboxes for terms agreements, gift wrapping, or options.
10. **Radio**: Radio button group for single-choice selections.
11. **Date**: Interactive calendar date picker for delivery date, event date, or birthday.
12. **Time**: Time picker for delivery time slots or preferred call times.
13. **DateTime**: Combined date and time picker.
14. **Slider / Range**: Range slider with live value badge, custom min/max/step, and unit prefix/suffix.
15. **Color Picker**: Native HTML5 color selector.
16. **Color Swatches**: Visual color palette buttons for gift card colors, packaging, or personalization.
17. **Picture Tiles**: Visual image tile selector allowing customers to choose between visual options (e.g. gift box styles, card templates).
18. **File Upload**: Secure file upload supporting images, PDF, documents, and archives with file type restrictions, maximum size limits, and email attachment support.
19. **Digital Signature**: Responsive HTML5 touch/mouse signature drawing pad with instant preview, clear button, high-resolution PNG generation, and email attachment options.


### Email & Admin Integration

* **Email Notification Attachments**: Choose whether uploaded files and customer signatures are attached to Admin emails, Customer emails, or both.
* **Email Body Summary**: Displays an order custom fields table in the order confirmation email body.
* **WooCommerce Admin Order Screen**:
    * Clean custom fields summary card.
    * Instant high-resolution preview and download links for customer signatures.
    * File upload manager with thumbnails, file sizes, and download buttons.
* **Thank You Page & Account**: Customers can review their submitted answers and signature confirmation after placing an order.

---

== Installation ==

1. Upload the `yeekit-checkout-field-blocks` folder to your `/wp-content/plugins/` directory, or install directly through WordPress Plugins screen (**Plugins > Add New**).
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Open your Checkout page in the WordPress Block Editor (**Pages > Checkout > Edit**).
4. Inside the **Checkout Block**, search for any of the custom field blocks (e.g. *Date*, *Select*, *Text*, *Radio*) under the **Checkout Block Fields** category.
5. Drag and position the fields wherever desired (e.g. Contact, Address, Shipping, or Order Note sections).
6. Customize field label, required status, placeholder, widths, option pricing, and options in the block sidebar inspector.
7. Click **Update** to save your checkout page.

== Frequently Asked Questions ==

= Does this plugin work with the new WooCommerce Checkout Block? =
Yes! Yeekit Checkout Field Blocks is designed specifically for the modern block-based WooCommerce Checkout Block (Gutenberg) with Store API integration.

= How does Option Pricing / Extra Fee work? =
Enable the **Enable Option Pricing / Extra Fee** toggle in the block settings sidebar. Then specify the price using the `Option Name | Price` syntax (e.g. `Express Delivery | 10.00`). When a customer selects the option on the checkout page, the price is automatically added as an extra fee to the cart and order total in real time.

= Is it compatible with WooCommerce High-Performance Order Storage (HPOS)? =
Yes! The plugin fully supports HPOS (Custom Order Tables) and traditional WordPress post meta storage simultaneously.

= Can I make fields required? =
Yes. Each block has a "Required" toggle in the sidebar settings. The checkout block will validate required fields before allowing the customer to complete payment.

= How do I access field values programmatically? =
Field values are saved in the WooCommerce Order object metadata. You can access them via:
`$value = $order->get_meta( '_yeekit_cfb_' . $field_key );`
or directly through `$order->get_meta( $field_key );`.

= Does it work with the classic checkout shortcode? =
Yes, the plugin includes built-in fallback rendering and dynamic AJAX fee calculations for classic shortcode checkout `[woocommerce_checkout]`.

== Screenshots ==

1. Visual field blocks in the WooCommerce Checkout Block editor.
2. Option Pricing with live (+ $X.XX) badges and real-time total recalculation.
3. Color Swatches and Picture Tiles with extra fee options.
4. Custom fields displayed in WooCommerce Admin Order details screen.
5. Order confirmation email with custom fields and extra fees summary.

== Changelog ==

= 1.2.1 =
* **New**: Option Pricing / Extra Fees feature for Select, Checkbox, Radio, Color Swatches, and Picture Tiles blocks.
* **New**: Real-time cart & order total fee recalculation via WooCommerce Store API and AJAX.
* **New**: Toggle control to enable/disable option pricing per block in Gutenberg Inspector.
* **Fix**: Store API update callback registration with `woocommerce_blocks_loaded`.
* **Fix**: Store API Nonce synchronization for seamless real-time fee calculation.

= 1.2.0 =
* Initial release of Yeekit Checkout Field Blocks for WooCommerce.
* Added 17 visual custom field blocks for WooCommerce Checkout Block.
* Added High-Performance Order Storage (HPOS) and Cart/Checkout Blocks compatibility.
* Added multi-column layout width options (100%, 50%, 33%).
* Full translation and internationalization readiness.

== Upgrade Notice ==

= 1.2.1 =
Yeekit Checkout Field Blocks 1.2.1 adds Option Pricing / Extra Fees for selectable blocks with real-time WooCommerce Store API cart total updates.
