Skip to content

Add Commerce, user, and address management CLI tools#13

Merged
elivz merged 13 commits intomainfrom
craft-commerce
Mar 16, 2026
Merged

Add Commerce, user, and address management CLI tools#13
elivz merged 13 commits intomainfrom
craft-commerce

Conversation

@elivz
Copy link
Copy Markdown
Contributor

@elivz elivz commented Mar 6, 2026

Summary

  • add Craft Commerce CLI support for stores, products, variants, orders, and full product type CRUD workflows
  • add user, user group, and address management tools, including permission and field layout support for singleton element owners
  • update shipped skill docs, README guidance, command wiring, and test coverage so the expanded CLI surface stays documented and reliable

Highlights

  • add new tool implementations, controllers, and command registrations across Commerce, users, user groups, and addresses
  • support create/get/list/update/delete flows for product types, products, variants, users, user groups, and addresses, plus order search and order/store updates
  • add address and user field layout helpers, including singleton layout handling and cache clearing for persisted layouts
  • expand tests and fixture stubs for Commerce-enabled scenarios, missing-Commerce behavior, field layout mutations, and parser/bootstrap regressions

elivz added 6 commits March 6, 2026 11:22
- Add 4 new tools: CreateProduct, CreateVariant, DeleteVariant, GetOrderStatuses
- Register CLI commands, HTTP routes, controllers, and SKILLS docs for new tools
- Fix GetProduct/GetProducts to use property access for defaultSku/defaultPrice
- Fix UpdateVariant to use basePrice instead of volatile price setter
- Fill coverage gaps across all 10 existing Commerce tools (29 new tests)
- Install Commerce 5.5.4 as dev dependency with ibericode/vat replacement
- Configure Commerce project config stubs (store, product type, order status, gateway)
Let Valinor's `allowScalarValueCasting()` handle string-to-int
conversion when the target parameter expects an int, avoiding type
mismatches for parameters expecting `string|null`.
Adds GetStores, GetStore, and UpdateStore tools for managing Commerce
store configuration (checkout behavior, pricing strategies, address
requirements, currency). Includes StoresController, CLI commands,
HTTP routes, SKILLS docs, and 37 new tests including a
CommerceNotInstalledTest that verifies all Commerce tools gracefully
handle missing Commerce installations.
@elivz elivz changed the title Add Craft Commerce support with products, variants, and orders Add Commerce CRUD tooling, docs, and PHPStan cleanup Mar 7, 2026
@elivz elivz requested a review from markhuot March 7, 2026 17:12
@elivz
Copy link
Copy Markdown
Contributor Author

elivz commented Mar 7, 2026

@markhuot I got all the basic Commerce functionality covered: products, variants, product types, orders, stores. My tests pass locally because I have Craft 5.9 installed, but looks like the CI test action is trying to install 5.8 which has a security advisory and the whole thing fails. I could pin ~5.9 in the project composer.json, but you mentioned you were trying to stay compatible with lower versions of Craft so I didn't want to do that without talking to you. Or maybe you have a better idea for a workaround. Currently Craft is just installed as a dependency of your Pest plugin, so it's not listed in the project composer.json at all.

One other thing to mention: I tweaked the argument parser slightly to not infer argument types initially. Otherwise it fails when running something like products/search --query="1234" because it coerces that "1234" to an int which is not accepted by Craft's search function.

elivz added 2 commits March 13, 2026 10:49
Expose Craft users, groups, permissions, and the global user field layout through the CLI and API so agents can manage accounts without editing project config.
@elivz elivz changed the title Add Commerce CRUD tooling, docs, and PHPStan cleanup Add Commerce, user, and address management CLI tools Mar 13, 2026
@markhuot
Copy link
Copy Markdown
Collaborator

I updated the github action to just pin to 5.9 for now. I have a separate branch where I’m hoping to add 4.x support and I can tackle older 5.x versions in the same pass. So, for now, we can just pin to the latest version here and worry about moving forward.

I’m good with this if you are. Feel free to merge!

@elivz elivz merged commit cd7b1c6 into main Mar 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants