Fluentcart extension architecture

From Lonsdale201/wp-agent-skills · View interactive version

Fluentcart extension architecture is an AI agent skill from the GitHub repository Lonsdale201/wp-agent-skills. 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, REST, or direct WordPr

How to use this skill

Skill file

FluentCart extension architecture

Establish the correct integration boundary before writing business logic. Do not

transpose WooCommerce CRUD, cart, session, order, or subscription assumptions

onto FluentCart.

Read data-and-lifecycle-map.md when the

change touches more than one entity or persists commerce state.

Bootstrap safely

modules, CPT, taxonomies, or migrated schema.

fluent_cart/register_payment_methods by fluentcart_loaded at the latest.

Those registration actions run on init before fluent_cart/init in 1.6.0, so

adding their listeners inside fluent_cart/init misses the event.

Do not infer Pro from a saved option.

~~~php

add_action('fluent_cart/init', static function ($app): void {

if (!defined('FLUENTCART_VERSION')) {

return;

}

// Register this addon's FluentCart hooks here.

});

~~~

The two lifecycle names are intentionally inconsistent:

fluentcart_loaded has no underscore after fluent; fluent_cart/init does.

Select the right persistence layer

| Data | Canonical layer |

|---|---|

| Product title/content/status | WordPress post APIs or ProductResource |

| Product detail, variants, attributes, stock | FluentCart Resource/service APIs |

| Orders, items, transactions, subscriptions | FluentCart models/resources and lifecycle services |

| Categories and brands | WordPress taxonomy APIs using FluentCart taxonomy names |

| Plugin settings | StoreSettings, ModuleSettings, or fluent_cart_* option helpers |

| Addon-owned state | Addon-owned table/options with explicit foreign identifiers |

Use Resource APIs for coordinated writes. Models are suitable for scoped reads

and documented model operations, but a raw model save can bypass validation,

secondary rows, counters, stock movements, event dispatch, remote gateway work,

or cache invalidation.

Never write fct_* rows with ad hoc SQL in normal request code. Restrict direct

SQL to migrations, bounded reports, or repairs that explicitly reproduce all

required invariants.

Preserve core invariants

Helper::toCent('12.34') yields 1234. Use FluentCart formatting helpers only

at display boundaries.

transactions, provider objects, cache keys, or reports.

state dimensions.

lookup tokens, not authorization by themselves.

Action Scheduler, and internal queues can execute more than once.

hook to the intended product, order, gateway, or integration key.

Extension workflow

  1. Record the installed Free, Pro, and companion-plugin versions.
  2. Identify the owning entity and the service that normally mutates it.
  3. Trace the controller/service to the final event rather than choosing a hook

by name alone.

  1. Confirm callback arguments and timing from source at the installed version.
  2. Add dependency guards and Free/Pro feature detection.
  3. Enforce authorization, object ownership, validation, and monetary units at

the addon's boundary.

  1. Test live/test separation, anonymous/authenticated paths, retries,

concurrent submission, and an interrupted background job.

Documentation accuracy rule

Treat the installed source and registered runtime routes as authoritative.

FluentCart's current developer pages contain some stale v1 URLs, generic cart

endpoints, fixed rate-limit claims, and a gateway example that omits metadata

required by GatewayManager in 1.6.0. Verify any copied example before shipping.

Cross-references

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.