{"skill":{"slug":"magento2","displayName":"Magento 2 Skill","summary":"Manage a Magento 2 / Adobe Commerce store via REST API. Use for orders, catalog, customers, inventory, promotions, and sales reporting. It can also discover...","description":"---\nname: magento2\ndescription: >\n  Manage a Magento 2 / Adobe Commerce store via REST API. Use for orders,\n  catalog, customers, inventory, promotions, and sales reporting. It can also\n  discover and interact with custom modules (like blogs) by exploring the\n  system's modules and REST schema. Triggers on requests like \"show me today's\n  orders\", \"update product stock\", \"check installed modules\", \"call custom api\",\n  \"morning brief\", \"store health\", \"inventory risk\", \"stockout\", \"promotion audit\",\n  \"stuck orders\", \"order exceptions\", \"pricing issues\", or anything referencing\n  a Magento store.\nversion: 1.1.0\nmetadata:\n  openclaw:\n    emoji: \"🛒\"\n    homepage: https://github.com/caravanglory/openclaw-magento2\n    primaryEnv: MAGENTO_BASE_URL\n    requires:\n      env:\n        - MAGENTO_BASE_URL\n        - MAGENTO_CONSUMER_KEY\n        - MAGENTO_CONSUMER_SECRET\n        - MAGENTO_ACCESS_TOKEN\n        - MAGENTO_ACCESS_TOKEN_SECRET\n      bins:\n        - python3\n    install:\n      - kind: uv\n        packages:\n          - requests\n          - requests-oauthlib\n          - pandas\n          - tabulate\n        label: \"Install Python dependencies (uv)\"\n---\n\n# Magento 2 Skill\n\nConnect to one or more Magento 2 / Adobe Commerce stores via REST API using OAuth 1.0a.\n\n## Authentication\n\nAll requests are signed with OAuth 1.0a. Credentials are read from environment variables — never ask the user to paste them in chat.\n\n### Single site (default)\n\n- `MAGENTO_BASE_URL` — e.g. `https://store.example.com`\n- `MAGENTO_CONSUMER_KEY`\n- `MAGENTO_CONSUMER_SECRET`\n- `MAGENTO_ACCESS_TOKEN`\n- `MAGENTO_ACCESS_TOKEN_SECRET`\n\n### Multi-site setup\n\nTo connect to additional stores, define credentials with a site suffix (`MAGENTO_<VAR>_<SITE>`):\n\n```\nMAGENTO_BASE_URL_US=https://us.store.com\nMAGENTO_CONSUMER_KEY_US=...\nMAGENTO_CONSUMER_SECRET_US=...\nMAGENTO_ACCESS_TOKEN_US=...\nMAGENTO_ACCESS_TOKEN_SECRET_US=...\n\nMAGENTO_BASE_URL_EU=https://eu.store.com\nMAGENTO_CONSUMER_KEY_EU=...\n...\n```\n\nAll scripts accept `--site <alias>` to target a specific store. When omitted, the default (unsuffixed) credentials are used.\n\n```\npython3 orders.py list --site us --limit 10\npython3 system.py sites            # list all configured sites\n```\n\n### Optional env vars\n\n- `MAGENTO_TIMEOUT` — Default is 30 seconds. Supports per-site override: `MAGENTO_TIMEOUT_US`.\n- `MAGENTO_DEBUG` — Set to 1 to enable verbose logging to stderr.\n\nAll scripts import the shared client from `scripts/magento_client.py`. Never construct raw HTTP requests inline — always use the client.\n\n## Available commands\n\nRun scripts with: `python3 <skill_dir>/scripts/<script>.py [args]`\n\n### Orders — `scripts/orders.py`\n\n```\n# List recent orders (default: last 20)\npython3 orders.py list [--limit N] [--status pending|processing|complete|canceled|closed|holded|payment_review]\n\n# Get a single order\npython3 orders.py get <order_id>\n\n# Update order status\npython3 orders.py update-status <order_id> <status>\n\n# Cancel an order\npython3 orders.py cancel <order_id>\n\n# Ship an order (optional: add tracking number and carrier)\npython3 orders.py ship <order_id> [--track N] [--carrier carrier_code] [--title title]\n\n# Invoice an order\npython3 orders.py invoice <order_id>\n```\n\n### Catalog — `scripts/catalog.py`\n\n```\n# Search products\npython3 catalog.py search <query> [--limit N]\n\n# Get product by SKU\npython3 catalog.py get <sku>\n\n# Update product price\npython3 catalog.py update-price <sku> <price>\n\n# Update product name / description\npython3 catalog.py update-attribute <sku> <attribute> <value>\n\n# Enable or disable a product\npython3 catalog.py update-status <sku> {enabled|disabled}\n\n# Delete a product\npython3 catalog.py delete <sku>\n\n# List categories\npython3 catalog.py categories\n```\n\n### Customers — `scripts/customers.py`\n\n```\n# Search customers by email or name\npython3 customers.py search <query> [--limit N]\n\n# Get customer by ID\npython3 customers.py get <customer_id>\n\n# Get customer orders\npython3 customers.py orders <customer_id>\n\n# Update customer group\npython3 customers.py update-group <customer_id> <group_id>\n```\n\n### Inventory — `scripts/inventory.py`\n\n```\n# Check stock for a SKU\npython3 inventory.py check <sku>\n\n# Update stock quantity\npython3 inventory.py update <sku> <qty>\n\n# List low-stock products (below threshold)\npython3 inventory.py low-stock [--threshold N]\n\n# Bulk stock check from a comma-separated SKU list\npython3 inventory.py bulk-check <sku1,sku2,...>\n```\n\n#### Multi-Source Inventory (MSI)\n\nRequires Magento 2.3+ with Inventory modules enabled.\n\n```\n# List inventory sources (warehouses)\npython3 inventory.py sources [--limit N]\n\n# Get details for a specific source\npython3 inventory.py source-get <source_code>\n\n# List source items (stock per source) — filter by SKU, source, or both\npython3 inventory.py source-items --sku <sku> [--source <source_code>] [--limit N]\n\n# Update quantity for a SKU at a specific source\npython3 inventory.py source-item-update <sku> <source_code> <qty>\n\n# Get salable quantity for a SKU in a stock\npython3 inventory.py salable-qty <sku> <stock_id>\n\n# Check if a product is salable in a stock\npython3 inventory.py is-salable <sku> <stock_id>\n\n# List inventory stocks (logical groupings)\npython3 inventory.py stocks [--limit N]\n```\n\n### Promotions — `scripts/promotions.py`\n\n```\n# List active cart price rules\npython3 promotions.py list [--active-only]\n\n# Get a rule by ID\npython3 promotions.py get <rule_id>\n\n# Create a coupon code for an existing rule\npython3 promotions.py create-coupon <rule_id> <code> [--uses N]\n\n# Disable a promotion rule\npython3 promotions.py disable <rule_id>\n\n# List coupon usage stats\npython3 promotions.py coupon-stats <coupon_code>\n```\n\n### Reporting — `scripts/reports.py`\n\n```\n# Sales summary for a date range\npython3 reports.py sales --from YYYY-MM-DD --to YYYY-MM-DD\n\n# Revenue by product (top N)\npython3 reports.py top-products [--limit N] [--from YYYY-MM-DD] [--to YYYY-MM-DD]\n\n# Revenue by customer (top N)\npython3 reports.py top-customers [--limit N] [--from YYYY-MM-DD] [--to YYYY-MM-DD]\n\n# Order status breakdown\npython3 reports.py order-status [--from YYYY-MM-DD] [--to YYYY-MM-DD]\n\n# Inventory value report\npython3 reports.py inventory-value\n```\n\n### System & Discovery — `scripts/system.py`\n\n```\n# Check API connection status\npython3 system.py status\n\n# List installed modules\npython3 system.py modules\n\n# Inspect REST schema\npython3 system.py schema\n\n# List all configured sites\npython3 system.py sites\n\n# Cache management\npython3 system.py cache-list\npython3 system.py cache-flush [--types ID1,ID2]\n```\n\n### Custom API — `scripts/custom_api.py`\n\nUse this for interacting with discovered custom endpoints.\n\n```\n# Call custom endpoints (e.g. blog module)\npython3 custom_api.py GET <path> [--params '{\"key\": \"value\"}']\npython3 custom_api.py POST <path> --data '{\"body\": \"json\"}'\n```\n\n### Morning Brief — `scripts/morning_brief.py`\n\nGenerate a daily store health summary across sales, orders, inventory, promotions, and customers.\n\n```\n# Generate morning brief (default: last 24 hours)\npython3 morning_brief.py brief [--site SITE] [--hours 24] [--stock-threshold 10]\n\n# JSON output for programmatic consumption\npython3 morning_brief.py brief --format json\n```\n\n### Diagnostics — `scripts/diagnose.py`\n\nDeep-dive analysis for specific store issues.\n\n```\n# Inventory risk radar with velocity-based stockout prediction\npython3 diagnose.py inventory-risk [--days 7] [--threshold 10] [--limit 50]\n\n# Audit promotions for expired rules, missing coupons, exhausted limits\npython3 diagnose.py promotion-audit [--warn-hours 48]\n\n# Find stuck orders (pending too long, payment review, processing delay)\npython3 diagnose.py order-exceptions [--pending-hours 24] [--processing-hours 48]\n\n# Detect pricing anomalies (zero price, negative price, inverted specials)\npython3 diagnose.py pricing-anomaly [--limit 50]\n\n# JSON output available for all subcommands\npython3 diagnose.py inventory-risk --format json\n```\n\n### Bulk Operations\n\nBatch update prices, stock, and shipments via CSV or inline input.\n\n```\n# Bulk update prices (preview mode)\npython3 catalog.py bulk-update-price --items \"SKU1:29.99,SKU2:49.99\"\npython3 catalog.py bulk-update-price --csv prices.csv\n\n# Execute bulk price changes\npython3 catalog.py bulk-update-price --csv prices.csv --execute\n\n# Bulk update stock\npython3 inventory.py bulk-update --items \"SKU1:100,SKU2:50\"\npython3 inventory.py bulk-update --csv stock.csv --execute\n\n# Bulk ship orders\npython3 orders.py bulk-ship --csv shipments.csv --execute\n```\n\n## Output format\n\nAll scripts print a UTF-8 table (via `tabulate`) or a JSON summary to stdout. When presenting results to the user, render them as a markdown table. For single-record lookups, format as a definition list.\n\n## Error handling\n\nScripts exit with code 1 on API errors and print a JSON error to stderr:\n```json\n{ \"error\": \"404 Not Found\", \"message\": \"No such entity with id = 99\", \"url\": \"...\" }\n```\n\nIf a script fails, read stderr, extract the `message` field, and tell the user plainly what went wrong. Do not retry automatically unless the user asks.\n\n## Rules\n\n- Never expose OAuth credentials in chat output, logs, or summaries.\n- For any **write operation** (cancel, delete, update-price, update-status, update-group, cache-flush, ship, invoice, create-coupon, disable, source-item-update, and all POST/PUT/DELETE via custom_api.py), always repeat the full command back to the user and wait for explicit confirmation before executing.\n- **Read-only operations** (list, get, search, check, status, modules, schema, cache-list, reports) may be executed directly without confirmation.\n- When a date range is not specified for reports, default to the last 30 days.\n- Monetary values are returned in the store's base currency — include the currency code in output.\n- **Multi-site**: When multiple sites are configured, always confirm which site the user intends before executing write operations. Use `system.py sites` to discover available sites.\n- **Production Safety**: After performing updates to products or prices, it is recommended to run `system.py cache-flush` if the changes don't appear on the frontend.\n- **Morning Brief** and **diagnose** commands are read-only — they may be executed directly without confirmation.\n- After generating a morning brief, proactively recommend relevant `diagnose.py` subcommands based on the findings.\n- **Bulk operations**: Always preview first (default), then require `--execute` flag and explicit user confirmation. Follow preview templates in `references/workflows.md`.\n- **Scenarios**: For detailed routing guidance, see `references/workflows.md`.","tags":{"latest":"1.3.1"},"stats":{"comments":0,"downloads":556,"installsAllTime":1,"installsCurrent":1,"stars":1,"versions":5},"createdAt":1774781580520,"updatedAt":1779079075024},"latestVersion":{"version":"1.3.1","createdAt":1774966758887,"changelog":"No file changes detected in this version.\n\n- No updates or modifications were made to the codebase or documentation.\n- Version number incremented without additional changes.\n- Behavior and features remain identical to the previous release.","license":"MIT-0"},"metadata":{"setup":[{"key":"MAGENTO_BASE_URL","required":true},{"key":"MAGENTO_CONSUMER_KEY","required":true},{"key":"MAGENTO_CONSUMER_SECRET","required":true},{"key":"MAGENTO_ACCESS_TOKEN","required":true},{"key":"MAGENTO_ACCESS_TOKEN_SECRET","required":true}],"os":null,"systems":null},"owner":{"handle":"caravanglory","userId":"s17crfjq811q0gwqcadapcwpe583vcjj","displayName":"Caravan Of Glory","image":"https://avatars.githubusercontent.com/u/7577849?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1780090211564}}