| 1 |
# Woo Dynamic Flow Module -- Implementation |
| 2 |
|
| 3 |
**Date:** 2026-03-04 |
| 4 |
**Module:** Woo Dynamic Flow (Module 10) |
| 5 |
|
| 6 |
## Implemented Abilities |
| 7 |
|
| 8 |
### 1. `cartflows/get-product-flow-mapping` (Read) |
| 9 |
|
| 10 |
**Config entry added to:** `class-cartflows-ability-config.php` |
| 11 |
**Runtime method added to:** `class-cartflows-ability-runtime.php` |
| 12 |
|
| 13 |
- **Method:** `get_product_flow_mapping( $input )` |
| 14 |
- **Permission:** `cartflows_manage_flows_steps` |
| 15 |
- **Input:** `product_id` (integer, required) |
| 16 |
- **Output:** `product_id`, `product_title`, `flow_id`, `flow_title`, `add_to_cart_text` |
| 17 |
- **Validations:** |
| 18 |
- WooCommerce must be active |
| 19 |
- Product must exist (via `wc_get_product`) |
| 20 |
- Flow title resolved only if flow exists with correct post type |
| 21 |
- **WooCommerce dependency:** Yes |
| 22 |
- **MCP annotations:** `readOnlyHint: true`, `idempotentHint: true`, `type: resource` |
| 23 |
|
| 24 |
### 2. `cartflows/list-product-flow-mappings` (Read) |
| 25 |
|
| 26 |
**Config entry added to:** `class-cartflows-ability-config.php` |
| 27 |
**Runtime method added to:** `class-cartflows-ability-runtime.php` |
| 28 |
|
| 29 |
- **Method:** `list_product_flow_mappings( $input )` |
| 30 |
- **Permission:** `cartflows_manage_flows_steps` |
| 31 |
- **Input:** `paged` (integer, default 1), `per_page` (integer, default 10, max 100) |
| 32 |
- **Output:** `mappings` (array), `total`, `total_pages`, `page` |
| 33 |
- **Query:** WP_Query on `product` post type with `meta_query` filtering `cartflows_redirect_flow_id` NOT IN ('', '0') |
| 34 |
- **WooCommerce dependency:** Yes |
| 35 |
- **MCP annotations:** `readOnlyHint: true`, `idempotentHint: true`, `type: resource` |
| 36 |
|
| 37 |
### 3. `cartflows/update-product-flow-mapping` (Write) |
| 38 |
|
| 39 |
**Config entry added to:** `class-cartflows-ability-config.php` |
| 40 |
**Runtime method added to:** `class-cartflows-ability-runtime.php` |
| 41 |
|
| 42 |
- **Method:** `update_product_flow_mapping( $input )` |
| 43 |
- **Permission:** `cartflows_abilities_api_write` + `cartflows_manage_flows_steps` |
| 44 |
- **Input:** `product_id` (integer, required), `flow_id` (integer, optional), `add_to_cart_text` (string, optional) |
| 45 |
- **Output:** `product_id`, `flow_id`, `flow_title`, `add_to_cart_text`, `message` |
| 46 |
- **Validations:** |
| 47 |
- WooCommerce must be active |
| 48 |
- Product must exist |
| 49 |
- If flow_id > 0, flow must exist with correct post type |
| 50 |
- Button text sanitized via `sanitize_text_field()` |
| 51 |
- **WooCommerce dependency:** Yes |
| 52 |
- **MCP annotations:** `readOnlyHint: false`, `idempotentHint: true`, `type: tool` |
| 53 |
|
| 54 |
## PHP Syntax Verification |
| 55 |
|
| 56 |
- `php -l class-cartflows-ability-config.php` -- No syntax errors detected |
| 57 |
- `php -l class-cartflows-ability-runtime.php` -- No syntax errors detected |
| 58 |
|
| 59 |
## Summary |
| 60 |
|
| 61 |
| Metric | Count | |
| 62 |
|--------|-------| |
| 63 |
| Abilities implemented | 3 | |
| 64 |
| Read abilities | 2 | |
| 65 |
| Write abilities | 1 | |
| 66 |
|