{"slug":"fluentcart-extension-architecture","title":"fluentcart-extension-architecture","summary":"Designs and audits third-party FluentCart extensions against the real 1.6.0 bootstrap, hybrid WordPress-post/custom-table data model, monetary units, Free/Pro boundary, and public helper APIs. Use when starting a FluentCart addon, choosing between hooks, models, Resource APIs, RE","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-09-16T14:51:45.088574Z","repo":{"url":"https://github.com/Lonsdale201/wp-agent-skills","stars":26,"forks":2,"license":"MIT","updatedAt":"2026-11-15T13:11:43Z"},"bodyHtml":"<hr>\n<h2>name: fluentcart-extension-architecture\ndescription: &gt;-\nDesigns and audits third-party FluentCart extensions against the real 1.6.0\nbootstrap, hybrid WordPress-post/custom-table data model, monetary units,\nFree/Pro boundary, and public helper APIs. Use when starting a FluentCart\naddon, choosing between hooks, models, Resource APIs, REST, or direct\nWordPress APIs, checking fluentcart_loaded or fluent_cart/init timing,\ndiagnosing missing classes, or reviewing code that reads or writes fct_*\ncommerce records.\nmetadata:\nwp-skills-author: \"Soczó Kristóf\"\nwp-skills-contact: \"mailto:lonsdale201@hotmail.com\"\nwp-skills-plugin: \"fluent-cart\"\nwp-skills-plugin-version-tested: \"1.6.0\"\nwp-skills-wp-version-tested: \"7.0.2\"\nwp-skills-php-min: \"7.4\"\nwp-skills-last-updated: \"2026-08-06\"</h2>\n<h1>FluentCart extension architecture</h1>\n<p>Establish the correct integration boundary before writing business logic. Do not\ntranspose WooCommerce CRUD, cart, session, order, or subscription assumptions\nonto FluentCart.</p>\n<p>Read <a href=\"references/data-and-lifecycle-map.md\">data-and-lifecycle-map.md</a> when the\nchange touches more than one entity or persists commerce state.</p>\n<h2>Bootstrap safely</h2>\n<ul>\n<li>Declare FluentCart as an integration dependency in the addon's own admin UX.</li>\n<li>Register classes and hooks no earlier than plugins_loaded.</li>\n<li>Use fluentcart_loaded when FluentCart's application object is required.</li>\n<li>Use fluent_cart/init for components that need FluentCart's init-time routes,\nmodules, CPT, taxonomies, or migrated schema.</li>\n<li>Attach listeners for fluent_cart/register_storage_drivers and\nfluent_cart/register_payment_methods by fluentcart_loaded at the latest.\nThose registration actions run on init before fluent_cart/init in 1.6.0, so\nadding their listeners inside fluent_cart/init misses the event.</li>\n<li>Feature-detect Pro with FLUENTCART_PRO_PLUGIN_VERSION or the exact Pro class.\nDo not infer Pro from a saved option.</li>\n<li>Recheck the minimum core/Pro version pair before using a newly added method.</li>\n</ul>\n<pre><code>add_action('fluent_cart/init', static function ($app): void {\n    if (!defined('FLUENTCART_VERSION')) {\n        return;\n    }\n\n    // Register this addon's FluentCart hooks here.\n});\n</code></pre>\n<p>The two lifecycle names are intentionally inconsistent:\nfluentcart_loaded has no underscore after fluent; fluent_cart/init does.</p>\n<h2>Select the right persistence layer</h2>\n<table>\n<thead>\n<tr>\n<th>Data</th>\n<th>Canonical layer</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Product title/content/status</td>\n<td>WordPress post APIs or ProductResource</td>\n</tr>\n<tr>\n<td>Product detail, variants, attributes, stock</td>\n<td>FluentCart Resource/service APIs</td>\n</tr>\n<tr>\n<td>Orders, items, transactions, subscriptions</td>\n<td>FluentCart models/resources and lifecycle services</td>\n</tr>\n<tr>\n<td>Categories and brands</td>\n<td>WordPress taxonomy APIs using FluentCart taxonomy names</td>\n</tr>\n<tr>\n<td>Plugin settings</td>\n<td>StoreSettings, ModuleSettings, or fluent_cart_* option helpers</td>\n</tr>\n<tr>\n<td>Addon-owned state</td>\n<td>Addon-owned table/options with explicit foreign identifiers</td>\n</tr>\n</tbody>\n</table>\n<p>Use Resource APIs for coordinated writes. Models are suitable for scoped reads\nand documented model operations, but a raw model save can bypass validation,\nsecondary rows, counters, stock movements, event dispatch, remote gateway work,\nor cache invalidation.</p>\n<p>Never write fct_* rows with ad hoc SQL in normal request code. Restrict direct\nSQL to migrations, bounded reports, or repairs that explicitly reproduce all\nrequired invariants.</p>\n<h2>Preserve core invariants</h2>\n<ul>\n<li>Treat monetary inputs and totals as integer minor units. In 1.6.0,\nHelper::toCent('12.34') yields 1234. Use FluentCart formatting helpers only\nat display boundaries.</li>\n<li>Keep store mode attached to every integration. Never mix test and live\ntransactions, provider objects, cache keys, or reports.</li>\n<li>Treat an order's status, payment_status, and shipping_status as separate\nstate dimensions.</li>\n<li>Treat Customer as a commerce identity distinct from WP_User.</li>\n<li>Treat cart_hash, order UUID, transaction UUID, and subscription UUID as\nlookup tokens, not authorization by themselves.</li>\n<li>Design callbacks and outbound effects for replay. Webhooks, checkout retries,\nAction Scheduler, and internal queues can execute more than once.</li>\n<li>Preserve filter inputs and return the documented type. Scope every dynamic\nhook to the intended product, order, gateway, or integration key.</li>\n</ul>\n<h2>Extension workflow</h2>\n<ol>\n<li>Record the installed Free, Pro, and companion-plugin versions.</li>\n<li>Identify the owning entity and the service that normally mutates it.</li>\n<li>Trace the controller/service to the final event rather than choosing a hook\nby name alone.</li>\n<li>Confirm callback arguments and timing from source at the installed version.</li>\n<li>Add dependency guards and Free/Pro feature detection.</li>\n<li>Enforce authorization, object ownership, validation, and monetary units at\nthe addon's boundary.</li>\n<li>Test live/test separation, anonymous/authenticated paths, retries,\nconcurrent submission, and an interrupted background job.</li>\n</ol>\n<h2>Documentation accuracy rule</h2>\n<p>Treat the installed source and registered runtime routes as authoritative.\nFluentCart's current developer pages contain some stale v1 URLs, generic cart\nendpoints, fixed rate-limit claims, and a gateway example that omits metadata\nrequired by GatewayManager in 1.6.0. Verify any copied example before shipping.</p>\n<h2>Cross-references</h2>\n<ul>\n<li>Use fluentcart-products-inventory for catalog and stock changes.</li>\n<li>Use fluentcart-orders-transactions for order events and status transitions.</li>\n<li>Use fluentcart-rest-headless for HTTP clients and custom endpoints.</li>\n</ul>\n<h2>References</h2>\n<ul>\n<li>Official developer documentation: <a href=\"https://dev.fluentcart.com/\">https://dev.fluentcart.com/</a></li>\n<li>Official database documentation: <a href=\"https://dev.fluentcart.com/database/\">https://dev.fluentcart.com/database/</a></li>\n<li>Verified Free source paths:\n<ul>\n<li>fluent-cart/fluent-cart.php</li>\n<li>fluent-cart/boot/app.php</li>\n<li>fluent-cart/boot/globals.php</li>\n<li>fluent-cart/api/FluentCartGeneralApi.php</li>\n<li>fluent-cart/api/Resource/</li>\n<li>fluent-cart/app/Models/</li>\n<li>fluent-cart/database/Migrations/</li>\n</ul>\n</li>\n<li>Verified Pro source path:\n<ul>\n<li>fluent-cart-pro/fluent-cart-pro.php</li>\n</ul>\n</li>\n</ul>\n","files":[{"path":"agents/openai.yaml","sizeBytes":313,"isText":true},{"path":"references/data-and-lifecycle-map.md","sizeBytes":4049,"isText":true},{"path":"SKILL.md","sizeBytes":5979,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-16T14:55:21.843745Z","sha256":"3295BD69170111D4402CA4EEA7D6FAAB8E2D651985E333AC49DE13D86895FF39","sizeBytes":5118},"review":null,"source":{"repositoryUrl":"https://github.com/Lonsdale201/wp-agent-skills","path":"fluentcart/fluentcart-extension-architecture","license":"MIT","commit":"9025fda280d15da3e2ba376a66940e75bd45f3ce","subtreeSha":"3083C43D4DF16EB1DC134C633B9193F732D160F0631710973F2210E3078D545A","lastSyncedAt":"2026-11-17T00:39:45.243627Z"},"reviewedAt":"2026-09-16T15:10:28.49114Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/Lonsdale201/wp-agent-skills/tree/main/fluentcart/fluentcart-extension-architecture"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install lonsdale201-wp-agent-skills@llmmart"},{"target":"git","command":"git clone https://github.com/Lonsdale201/wp-agent-skills.git"}]}