Run runtime-backed commands from a real OpenCart 3.x root:
oc core:version
oc core:check-requirements
oc product:list --limit=5Run from outside the store by pointing at an OpenCart root:
oc core:version \
--opencart-root=/var/www/opencartRun DB-native commands from anywhere with direct DB flags:
oc db:info \
--db-host=localhost \
--db-user=oc_user \
--db-pass=secret \
--db-name=opencartList settings:
oc core:config list
oc core:config list --format=jsonRead and write values:
oc core:config get config_name
oc core:config set config_name "My Store"
oc core:config set config_maintenance 1
oc core:config set config_maintenance 0Deprecated compatibility flag:
oc core:config list --adminThe command accepts the flag but warns that OpenCart settings are stored in shared rows.
Create backups:
oc db:backup
oc db:backup "backup_$(date +%Y%m%d_%H%M%S).sql"
oc db:backup nightly.sql --compress
oc db:backup products.sql --tables=oc_product,oc_product_descriptionRestore backups:
oc db:restore nightly.sql
oc db:restore nightly.sql --force
oc db:restore nightly.sql --ignore-errorsMaintenance commands:
oc db:check
oc db:repair oc_product
oc db:optimize product product_description
oc db:cleanupStructured output for maintenance automation:
oc db:check --format=json | jq '.[].status'
oc db:cleanup --format=yamlThese commands require a real OpenCart 3.x installation root.
Clear specific cache types:
oc cache:clear --type=data
oc cache:clear --type=theme
oc cache:clear --type=allRefresh modification output and clear related caches:
oc cache:rebuild --type=modification
oc cache:rebuild --type=allList enabled extension rows:
oc extension:list
oc extension:list payment
oc extension:list module --format=jsonEnable and disable by identifier:
oc extension:enable payment:paypal
oc extension:disable payment:paypalDisable by code when the code is unique:
oc extension:disable paypalImport an OCMOD XML package:
oc extension:install ./upload.ocmod.xml
oc extension:install ./upload.ocmod.xml --activate
oc modification:listThese commands require a real OpenCart 3.x installation root.
List categories:
oc category:list
oc category:list --name=Desktops
oc category:list --sort=name --order=desc --format=jsonCreate categories:
oc category:create "CLI Specials"
oc category:create "CLI Accessories" \
--parent-id=20 \
--description="Created by OC-CLI" \
--keyword=cli-accessories \
--store=0,1 \
--status=enabledDefault listing:
oc product:listFilter by status and limit:
oc product:list --status=enabled --limit=10
oc product:list --status=disabled --format=jsonSearch and category filtering:
oc product:list --search=iphone
oc product:list Desktops
oc product:list 20 --search=MacBasic creation:
oc product:create "Samsung Galaxy S21" "SGS21" "799.99"Creation with metadata:
oc product:create "Samsung Galaxy S21" "SGS21" "799.99" \
--description="Latest Samsung smartphone" \
--category=Smartphones \
--quantity=50 \
--status=enabled \
--weight=0.17 \
--sku=SAMSUNG-SGS21 \
--image=catalog/demo/samsung-galaxy-s21.jpg \
--meta-title="Samsung Galaxy S21"Interactive creation:
oc product:create --interactiveStructured output for automation:
oc product:create "API Product" "API-001" "99.99" --format=json
oc product:list --format=json | jq '.[].model'Update a few fields:
oc product:update 100 --price=24.99 --quantity=12 --status=enabled
oc product:update 100 --name="CLI Product Updated" --description="Updated from OC-CLI"Update assignment and inventory behavior:
oc product:update 100 \
--category=20,24 \
--sku=CLI-100 \
--image=catalog/demo/cli-product.jpg \
--subtract=1Delete a product:
oc product:delete 100 --forceThese commands require a real OpenCart 3.x installation root.
List and inspect orders:
oc order:list
oc order:list --customer=John --status-id=1 --limit=10
oc order:view 1
oc order:view 1 --format=json | jq '.order.order_status_id'Update order status:
oc order:update-status 1 Processing --comment="Validated by CLI" --notify
oc order:update-status 1 Complete --comment="Released for fulfillment" --overrideThese commands manage admin users, not storefront customers. They require a real OpenCart 3.x installation root.
List users:
oc user:list
oc user:list --status=enabled
oc user:list --group=1 --sort=date_added --order=desc --format=jsonCreate and delete users:
oc user:create cli-admin cli-admin@example.com 'StrongPass!123' \
--firstname=CLI \
--lastname=Admin \
--group-id=1 \
--status=enabled
oc user:delete cli-admin --forceNightly backup:
0 2 * * * cd /var/www/opencart && /usr/bin/env oc db:backup "auto_backup_$(date +\%Y\%m\%d).sql" --compressRequirements check:
oc core:check-requirements --format=yamlNightly maintenance:
0 3 * * * cd /var/www/opencart && /usr/bin/env oc cache:rebuild --type=all
15 3 * * * cd /var/www/opencart && /usr/bin/env oc db:cleanup