fluentcart-developer 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +22 -22
- package/LICENSE +21 -21
- package/README.md +169 -127
- package/SKILL.md +127 -127
- package/bin/index.js +281 -281
- package/package.json +48 -37
- package/skills/fluentcart-developer/SKILL.md +172 -172
- package/skills/fluentcart-developer/examples/README.md +25 -25
- package/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/fluent-cart/checkout.php +32 -32
- package/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/functions.php +40 -40
- package/skills/fluentcart-developer/examples/sample-custom-addon/fluentcart-custom-addon.php +114 -114
- package/skills/fluentcart-developer/examples/sample-custom-payment-gateway/fluentcart-custom-gateway-example.php +149 -149
- package/skills/fluentcart-developer/examples/sample-fee-surcharge-plugin/fluentcart-fee-surcharge.php +38 -38
- package/skills/fluentcart-developer/examples/sample-shipping-carrier/fluentcart-custom-shipping-carrier.php +62 -62
- package/skills/fluentcart-developer/references/action-hooks-admin-templates.md +787 -787
- package/skills/fluentcart-developer/references/action-hooks-cart-checkout.md +1355 -1355
- package/skills/fluentcart-developer/references/action-hooks-customers-users.md +266 -266
- package/skills/fluentcart-developer/references/action-hooks-licenses.md +855 -855
- package/skills/fluentcart-developer/references/action-hooks-orders.md +631 -631
- package/skills/fluentcart-developer/references/action-hooks-payments-integrations.md +963 -963
- package/skills/fluentcart-developer/references/action-hooks-products-coupons.md +585 -585
- package/skills/fluentcart-developer/references/action-hooks-subscriptions.md +661 -661
- package/skills/fluentcart-developer/references/database-models-query-builder.md +194 -194
- package/skills/fluentcart-developer/references/database-models-reference.md +604 -604
- package/skills/fluentcart-developer/references/database-schema-reference.md +940 -940
- package/skills/fluentcart-developer/references/engineering-notes.md +154 -154
- package/skills/fluentcart-developer/references/fee-system-guide.md +449 -449
- package/skills/fluentcart-developer/references/filter-hooks-cart-checkout.md +1202 -1202
- package/skills/fluentcart-developer/references/filter-hooks-customers-subscriptions.md +902 -902
- package/skills/fluentcart-developer/references/filter-hooks-integrations-advanced.md +1598 -1598
- package/skills/fluentcart-developer/references/filter-hooks-orders-payments.md +1319 -1319
- package/skills/fluentcart-developer/references/filter-hooks-products-pricing.md +628 -628
- package/skills/fluentcart-developer/references/filter-hooks-settings-configuration.md +1177 -1177
- package/skills/fluentcart-developer/references/fluentcart-developer-guide.md +154 -154
- package/skills/fluentcart-developer/references/ghost-product-selling.md +458 -458
- package/skills/fluentcart-developer/references/modules-and-extensions-reference.md +224 -224
- package/skills/fluentcart-developer/references/payment-gateway-integration.md +761 -761
- package/skills/fluentcart-developer/references/rest-api-checkout.md +286 -286
- package/skills/fluentcart-developer/references/rest-api-coupons.md +794 -794
- package/skills/fluentcart-developer/references/rest-api-customer-profile.md +190 -190
- package/skills/fluentcart-developer/references/rest-api-customers.md +1121 -1121
- package/skills/fluentcart-developer/references/rest-api-dashboard-utilities.md +219 -219
- package/skills/fluentcart-developer/references/rest-api-email-notifications.md +619 -619
- package/skills/fluentcart-developer/references/rest-api-files.md +290 -290
- package/skills/fluentcart-developer/references/rest-api-integrations.md +324 -324
- package/skills/fluentcart-developer/references/rest-api-labels-attributes.md +321 -321
- package/skills/fluentcart-developer/references/rest-api-licensing.md +171 -171
- package/skills/fluentcart-developer/references/rest-api-order-bumps.md +200 -200
- package/skills/fluentcart-developer/references/rest-api-orders.md +1241 -1241
- package/skills/fluentcart-developer/references/rest-api-overview.md +131 -131
- package/skills/fluentcart-developer/references/rest-api-products.md +2563 -2563
- package/skills/fluentcart-developer/references/rest-api-public-shop.md +172 -172
- package/skills/fluentcart-developer/references/rest-api-reference.md +552 -552
- package/skills/fluentcart-developer/references/rest-api-reports.md +377 -377
- package/skills/fluentcart-developer/references/rest-api-roles-permissions.md +147 -147
- package/skills/fluentcart-developer/references/rest-api-settings.md +528 -528
- package/skills/fluentcart-developer/references/rest-api-shipping.md +799 -799
- package/skills/fluentcart-developer/references/rest-api-subscriptions.md +606 -606
- package/skills/fluentcart-developer/references/rest-api-tax.md +356 -356
- package/skills/fluentcart-developer/references/subscription-customization.md +197 -197
- package/skills/fluentcart-developer/scripts/cli.js +1 -1
- package/.gitattributes +0 -2
- package/CONTRIBUTING.md +0 -73
- package/copy-skills.js +0 -43
- package/skills.sh.json +0 -13
package/SKILL.md
CHANGED
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: "
|
|
3
|
-
description: "Comprehensive knowledge base for FluentCart WordPress e-commerce plugin and theme development. Covers theme compatibility, template system, shortcodes, action/filter hooks, Elementor & Bricks integration, custom payment gateways, database models, REST API, fee systems, ghost products, subscriptions, and variations. Use this skill when building themes, plugins, or custom extensions for FluentCart."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# FluentCart Developer Knowledge Base
|
|
7
|
-
|
|
8
|
-
This skill is the comprehensive developer index and reference guide for building WordPress themes, custom plugins, payment gateways, builder blocks, REST API extensions, and custom e-commerce workflows for FluentCart.
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## 1. Advanced Developer References
|
|
13
|
-
|
|
14
|
-
For detailed code guides, schemas, and API specifications, consult the individual manuals in the `references/` directory:
|
|
15
|
-
|
|
16
|
-
- [Theme Development Guide](references/theme-development-guide.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/theme-development-guide.md)) — Complete guide for block and classic themes, template overrides, page types, and asset enqueuing.
|
|
17
|
-
- [Custom Payment Gateway Integration](references/payment-gateway-integration.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/payment-gateway-integration.md)) — Register custom gateways (`AbstractPaymentGateway`), settings schemas (`BaseGatewaySettings`), capture/refund methods, and card update redirect flows.
|
|
18
|
-
- [Paddle Payment Gateway Case Study](references/paddle-gateway-case-study.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/paddle-gateway-case-study.md)) — Implementation detail, setting fields schema, and webhook listener setup.
|
|
19
|
-
- [Ghost Product Selling (Non-Catalog Items)](references/ghost-product-selling.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/ghost-product-selling.md)) — Dynamically create virtual line items without adding products to the database catalog.
|
|
20
|
-
- [Fee System (Surcharges & Custom Fees)](references/fee-system-guide.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/fee-system-guide.md)) — Inject dynamic cart surcharges or store persistent fees in database tables.
|
|
21
|
-
- [Subscription Customization](references/subscription-customization.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/subscription-customization.md)) — Adjust renewal grace periods, custom billing cycles, auto-renew cancellation, and license key defaults.
|
|
22
|
-
- [Database Models & Query Builder](references/database-models-query-builder.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/database-models-query-builder.md)) — Query FluentCart records using Eloquent ORM models (`Order`, `Customer`, `Product`, `Subscription`, `Cart`).
|
|
23
|
-
- [Exhaustive Database Models Reference](references/database-models-reference.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/database-models-reference.md)) — Deep field definitions, properties, and relationships for 30+ database models.
|
|
24
|
-
- [Database Schema Reference](references/database-schema-reference.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/database-schema-reference.md)) — Tables, column types, and index catalog (`fc_orders`, `fc_order_items`, `fc_customers`, etc.).
|
|
25
|
-
- [Action & Filter Hooks Reference](references/hooks-actions-filters.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/hooks-actions-filters.md)) — Hook overview for order status changes, payment triggers, and UI extensions.
|
|
26
|
-
- [Exhaustive Action Hooks Reference](references/hooks-actions-reference.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/hooks-actions-reference.md)) — Full catalog of actions triggered across the FluentCart lifecycle.
|
|
27
|
-
- [Exhaustive Filter Hooks Reference](references/hooks-filters-reference.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/hooks-filters-reference.md)) — Full catalog of filters allowing data modification (e.g. `fluent_cart/transaction/max_refundable_amount`).
|
|
28
|
-
- [REST API Endpoints Reference](references/rest-api-endpoints-reference.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/rest-api-endpoints-reference.md)) — Quick list of API paths and payload parameters.
|
|
29
|
-
- [Exhaustive REST API Reference](references/rest-api-reference.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/rest-api-reference.md)) — Complete request payloads, response schemas, and authentication endpoints.
|
|
30
|
-
- [REST API & Webhooks Guide](references/rest-api-webhooks.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/rest-api-webhooks.md)) — Authorization tokens, nonce validation, and outgoing webhook listeners.
|
|
31
|
-
- [Shipping, Storage, Licensing & Order Bumps](references/shipping-storage-licensing.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/shipping-storage-licensing.md)) — Custom shipping rate carriers, storage driver APIs, software license keys, and checkout bumps.
|
|
32
|
-
- [Gutenberg Blocks & Elementor / Bricks Widgets](references/gutenberg-blocks-elementor-widgets.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/gutenberg-blocks-elementor-widgets.md)) — Block names, elementor locations, and 15+ Bricks Builder blocks (v1.5.4+).
|
|
33
|
-
- [WP-CLI Commands Reference](references/wp-cli-commands.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/wp-cli-commands.md)) — CLI commands for maintenance, database synchronization, and migrations.
|
|
34
|
-
- [Easy Digital Downloads (EDD) Migration Guide](references/edd-migration-compatibility-guide.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/edd-migration-compatibility-guide.md)) — Store migration steps and legacy EDD licensing endpoint emulation.
|
|
35
|
-
|
|
36
|
-
### Standalone Code Examples (`examples/`)
|
|
37
|
-
For full boilerplate plugins and child theme files, consult the `examples/` directory:
|
|
38
|
-
- `examples/sample-custom-payment-gateway/fluentcart-custom-gateway-example.php` — Complete custom payment gateway plugin boilerplate.
|
|
39
|
-
- `examples/sample-shipping-carrier/fluentcart-custom-shipping-carrier.php` — Custom dynamic shipping calculation plugin.
|
|
40
|
-
- `examples/fluentcart-starter-child-theme/` — Starter child theme with `functions.php` theme support & `fluent-cart/checkout.php` override.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## 2. Core Framework & Architecture Setup
|
|
45
|
-
|
|
46
|
-
### A. Theme Support Declaration
|
|
47
|
-
To enable FluentCart template loading, template overrides, and custom page detection in a theme, declare support in `functions.php`:
|
|
48
|
-
|
|
49
|
-
```php
|
|
50
|
-
// Must be added to your theme's functions.php
|
|
51
|
-
add_action('after_setup_theme', function() {
|
|
52
|
-
add_theme_support('fluent_cart');
|
|
53
|
-
});
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### B. Global Helper Functions & Formatting
|
|
57
|
-
```php
|
|
58
|
-
// Check if FluentCart core is installed & active
|
|
59
|
-
if (defined('FLUENTCART_VERSION')) {
|
|
60
|
-
$version = FLUENTCART_VERSION; // e.g. '1.5.5'
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Detect current FluentCart page type
|
|
64
|
-
$pageType = \FluentCart\App\Services\Templates\TemplateService::getCurrentFcPageType();
|
|
65
|
-
// Returns: 'shop' | 'single_product' | 'product_taxonomy' | 'cart' | 'checkout' | 'receipt' | 'customer_dashboard'
|
|
66
|
-
|
|
67
|
-
// Access Store Settings API & Format Currency
|
|
68
|
-
$storeSettings = new \FluentCart\Api\StoreSettings();
|
|
69
|
-
$shopPageUrl = $storeSettings->getShopPage();
|
|
70
|
-
$currency = $storeSettings->getCurrency();
|
|
71
|
-
|
|
72
|
-
// Format monetary amounts using store settings
|
|
73
|
-
$formattedPrice = \FluentCart\App\Helpers\Helper::formatMoney(4990); // Formats $49.90
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## 3. Checkout Execution Lifecycle (Order of Operations)
|
|
79
|
-
|
|
80
|
-
Senior developers must understand the exact execution sequence during checkout processing:
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
[Customer Submits Form]
|
|
84
|
-
│
|
|
85
|
-
▼
|
|
86
|
-
1. fluent_cart/checkout/before_validate_cart --> Add custom pre-checks
|
|
87
|
-
│
|
|
88
|
-
▼
|
|
89
|
-
2. fluent_cart/checkout/validate_cart --> Validate input data & stock
|
|
90
|
-
│
|
|
91
|
-
▼
|
|
92
|
-
3. fluent_cart/checkout/before_order_create --> Modify cart payload or totals
|
|
93
|
-
│
|
|
94
|
-
▼
|
|
95
|
-
4. fluent_cart/order_created --> Order model created in DB (Status: pending)
|
|
96
|
-
│
|
|
97
|
-
▼
|
|
98
|
-
5. Payment Gateway -> makePaymentFromPaymentInstance()
|
|
99
|
-
│
|
|
100
|
-
▼
|
|
101
|
-
6. (new StatusHelper($order))->syncOrderStatuses($transaction)
|
|
102
|
-
│
|
|
103
|
-
├─► fluent_cart/payment_completed --> Payment record created
|
|
104
|
-
├─► fluent_cart/order_paid --> Fired if transaction succeeded
|
|
105
|
-
└─► fluent_cart/order_status_updated --> Order status changed to 'processing'/'completed'
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
## 4. Security, Nonce Validation & Capability Checks
|
|
111
|
-
|
|
112
|
-
All custom endpoints, AJAX actions, and admin settings handlers must follow strict security standards:
|
|
113
|
-
|
|
114
|
-
```php
|
|
115
|
-
// 1. Check FluentCart Admin Permissions
|
|
116
|
-
if (!current_user_can('manage_options') && !fluent_cart_user_can('manage_fluentcart')) {
|
|
117
|
-
wp_send_json(['status' => 'error', 'message' => 'Unauthorized access'], 403);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// 2. Validate Nonce Verification in AJAX Endpoints
|
|
121
|
-
if (!check_ajax_referer('fluent_cart_nonce', 'nonce', false)) {
|
|
122
|
-
wp_send_json(['status' => 'error', 'message' => 'Invalid security token'], 403);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// 3. Input Sanitization Example
|
|
126
|
-
$cleanInput = sanitize_text_field($_POST['custom_field'] ?? '');
|
|
127
|
-
```
|
|
1
|
+
---
|
|
2
|
+
name: "fluentcart-developer"
|
|
3
|
+
description: "Comprehensive knowledge base for FluentCart WordPress e-commerce plugin and theme development. Covers theme compatibility, template system, shortcodes, action/filter hooks, Elementor & Bricks integration, custom payment gateways, database models, REST API, fee systems, ghost products, subscriptions, and variations. Use this skill when building themes, plugins, or custom extensions for FluentCart."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# FluentCart Developer Knowledge Base
|
|
7
|
+
|
|
8
|
+
This skill is the comprehensive developer index and reference guide for building WordPress themes, custom plugins, payment gateways, builder blocks, REST API extensions, and custom e-commerce workflows for FluentCart.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 1. Advanced Developer References
|
|
13
|
+
|
|
14
|
+
For detailed code guides, schemas, and API specifications, consult the individual manuals in the `references/` directory:
|
|
15
|
+
|
|
16
|
+
- [Theme Development Guide](references/theme-development-guide.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/theme-development-guide.md)) — Complete guide for block and classic themes, template overrides, page types, and asset enqueuing.
|
|
17
|
+
- [Custom Payment Gateway Integration](references/payment-gateway-integration.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/payment-gateway-integration.md)) — Register custom gateways (`AbstractPaymentGateway`), settings schemas (`BaseGatewaySettings`), capture/refund methods, and card update redirect flows.
|
|
18
|
+
- [Paddle Payment Gateway Case Study](references/paddle-gateway-case-study.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/paddle-gateway-case-study.md)) — Implementation detail, setting fields schema, and webhook listener setup.
|
|
19
|
+
- [Ghost Product Selling (Non-Catalog Items)](references/ghost-product-selling.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/ghost-product-selling.md)) — Dynamically create virtual line items without adding products to the database catalog.
|
|
20
|
+
- [Fee System (Surcharges & Custom Fees)](references/fee-system-guide.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/fee-system-guide.md)) — Inject dynamic cart surcharges or store persistent fees in database tables.
|
|
21
|
+
- [Subscription Customization](references/subscription-customization.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/subscription-customization.md)) — Adjust renewal grace periods, custom billing cycles, auto-renew cancellation, and license key defaults.
|
|
22
|
+
- [Database Models & Query Builder](references/database-models-query-builder.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/database-models-query-builder.md)) — Query FluentCart records using Eloquent ORM models (`Order`, `Customer`, `Product`, `Subscription`, `Cart`).
|
|
23
|
+
- [Exhaustive Database Models Reference](references/database-models-reference.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/database-models-reference.md)) — Deep field definitions, properties, and relationships for 30+ database models.
|
|
24
|
+
- [Database Schema Reference](references/database-schema-reference.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/database-schema-reference.md)) — Tables, column types, and index catalog (`fc_orders`, `fc_order_items`, `fc_customers`, etc.).
|
|
25
|
+
- [Action & Filter Hooks Reference](references/hooks-actions-filters.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/hooks-actions-filters.md)) — Hook overview for order status changes, payment triggers, and UI extensions.
|
|
26
|
+
- [Exhaustive Action Hooks Reference](references/hooks-actions-reference.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/hooks-actions-reference.md)) — Full catalog of actions triggered across the FluentCart lifecycle.
|
|
27
|
+
- [Exhaustive Filter Hooks Reference](references/hooks-filters-reference.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/hooks-filters-reference.md)) — Full catalog of filters allowing data modification (e.g. `fluent_cart/transaction/max_refundable_amount`).
|
|
28
|
+
- [REST API Endpoints Reference](references/rest-api-endpoints-reference.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/rest-api-endpoints-reference.md)) — Quick list of API paths and payload parameters.
|
|
29
|
+
- [Exhaustive REST API Reference](references/rest-api-reference.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/rest-api-reference.md)) — Complete request payloads, response schemas, and authentication endpoints.
|
|
30
|
+
- [REST API & Webhooks Guide](references/rest-api-webhooks.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/rest-api-webhooks.md)) — Authorization tokens, nonce validation, and outgoing webhook listeners.
|
|
31
|
+
- [Shipping, Storage, Licensing & Order Bumps](references/shipping-storage-licensing.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/shipping-storage-licensing.md)) — Custom shipping rate carriers, storage driver APIs, software license keys, and checkout bumps.
|
|
32
|
+
- [Gutenberg Blocks & Elementor / Bricks Widgets](references/gutenberg-blocks-elementor-widgets.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/gutenberg-blocks-elementor-widgets.md)) — Block names, elementor locations, and 15+ Bricks Builder blocks (v1.5.4+).
|
|
33
|
+
- [WP-CLI Commands Reference](references/wp-cli-commands.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/wp-cli-commands.md)) — CLI commands for maintenance, database synchronization, and migrations.
|
|
34
|
+
- [Easy Digital Downloads (EDD) Migration Guide](references/edd-migration-compatibility-guide.md) ([Online](https://raw.githubusercontent.com/atifjubaer/skills/master/references/edd-migration-compatibility-guide.md)) — Store migration steps and legacy EDD licensing endpoint emulation.
|
|
35
|
+
|
|
36
|
+
### Standalone Code Examples (`examples/`)
|
|
37
|
+
For full boilerplate plugins and child theme files, consult the `examples/` directory:
|
|
38
|
+
- `examples/sample-custom-payment-gateway/fluentcart-custom-gateway-example.php` — Complete custom payment gateway plugin boilerplate.
|
|
39
|
+
- `examples/sample-shipping-carrier/fluentcart-custom-shipping-carrier.php` — Custom dynamic shipping calculation plugin.
|
|
40
|
+
- `examples/fluentcart-starter-child-theme/` — Starter child theme with `functions.php` theme support & `fluent-cart/checkout.php` override.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 2. Core Framework & Architecture Setup
|
|
45
|
+
|
|
46
|
+
### A. Theme Support Declaration
|
|
47
|
+
To enable FluentCart template loading, template overrides, and custom page detection in a theme, declare support in `functions.php`:
|
|
48
|
+
|
|
49
|
+
```php
|
|
50
|
+
// Must be added to your theme's functions.php
|
|
51
|
+
add_action('after_setup_theme', function() {
|
|
52
|
+
add_theme_support('fluent_cart');
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### B. Global Helper Functions & Formatting
|
|
57
|
+
```php
|
|
58
|
+
// Check if FluentCart core is installed & active
|
|
59
|
+
if (defined('FLUENTCART_VERSION')) {
|
|
60
|
+
$version = FLUENTCART_VERSION; // e.g. '1.5.5'
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Detect current FluentCart page type
|
|
64
|
+
$pageType = \FluentCart\App\Services\Templates\TemplateService::getCurrentFcPageType();
|
|
65
|
+
// Returns: 'shop' | 'single_product' | 'product_taxonomy' | 'cart' | 'checkout' | 'receipt' | 'customer_dashboard'
|
|
66
|
+
|
|
67
|
+
// Access Store Settings API & Format Currency
|
|
68
|
+
$storeSettings = new \FluentCart\Api\StoreSettings();
|
|
69
|
+
$shopPageUrl = $storeSettings->getShopPage();
|
|
70
|
+
$currency = $storeSettings->getCurrency();
|
|
71
|
+
|
|
72
|
+
// Format monetary amounts using store settings
|
|
73
|
+
$formattedPrice = \FluentCart\App\Helpers\Helper::formatMoney(4990); // Formats $49.90
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 3. Checkout Execution Lifecycle (Order of Operations)
|
|
79
|
+
|
|
80
|
+
Senior developers must understand the exact execution sequence during checkout processing:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
[Customer Submits Form]
|
|
84
|
+
│
|
|
85
|
+
▼
|
|
86
|
+
1. fluent_cart/checkout/before_validate_cart --> Add custom pre-checks
|
|
87
|
+
│
|
|
88
|
+
▼
|
|
89
|
+
2. fluent_cart/checkout/validate_cart --> Validate input data & stock
|
|
90
|
+
│
|
|
91
|
+
▼
|
|
92
|
+
3. fluent_cart/checkout/before_order_create --> Modify cart payload or totals
|
|
93
|
+
│
|
|
94
|
+
▼
|
|
95
|
+
4. fluent_cart/order_created --> Order model created in DB (Status: pending)
|
|
96
|
+
│
|
|
97
|
+
▼
|
|
98
|
+
5. Payment Gateway -> makePaymentFromPaymentInstance()
|
|
99
|
+
│
|
|
100
|
+
▼
|
|
101
|
+
6. (new StatusHelper($order))->syncOrderStatuses($transaction)
|
|
102
|
+
│
|
|
103
|
+
├─► fluent_cart/payment_completed --> Payment record created
|
|
104
|
+
├─► fluent_cart/order_paid --> Fired if transaction succeeded
|
|
105
|
+
└─► fluent_cart/order_status_updated --> Order status changed to 'processing'/'completed'
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## 4. Security, Nonce Validation & Capability Checks
|
|
111
|
+
|
|
112
|
+
All custom endpoints, AJAX actions, and admin settings handlers must follow strict security standards:
|
|
113
|
+
|
|
114
|
+
```php
|
|
115
|
+
// 1. Check FluentCart Admin Permissions
|
|
116
|
+
if (!current_user_can('manage_options') && !fluent_cart_user_can('manage_fluentcart')) {
|
|
117
|
+
wp_send_json(['status' => 'error', 'message' => 'Unauthorized access'], 403);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// 2. Validate Nonce Verification in AJAX Endpoints
|
|
121
|
+
if (!check_ajax_referer('fluent_cart_nonce', 'nonce', false)) {
|
|
122
|
+
wp_send_json(['status' => 'error', 'message' => 'Invalid security token'], 403);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// 3. Input Sanitization Example
|
|
126
|
+
$cleanInput = sanitize_text_field($_POST['custom_field'] ?? '');
|
|
127
|
+
```
|