Skip to main content

CLI Commands Reference

Mage2Plenty provides a comprehensive set of CLI commands for managing synchronization, testing, and system maintenance. This reference covers all available commands organized by functionality.

Quick Reference

# System & Setup
bin/magento plenty:system:check # System health check
bin/magento plenty:client:test # Test API connection
bin/magento plenty:setup:init # Complete initial setup

# Profile Management
bin/magento plenty:item:import # Import products
bin/magento plenty:item:export # Export products
bin/magento plenty:order:export # Export orders
bin/magento plenty:stock:import # Import stock
bin/magento plenty:customer:export # Export customers

# Maintenance
bin/magento plenty:log:process # Process API logs
bin/magento plenty:*:flush-data # Clear module data

System Commands

System Check

Comprehensive system health check including PHP version, Magento version, modules, configuration, file permissions, and API connection.

bin/magento plenty:system:check

Checks performed:

  • ✅ PHP version and extensions
  • ✅ Magento version compatibility
  • ✅ Module status
  • ✅ Client configuration
  • ✅ File system permissions
  • ✅ API connectivity

Example output:

PlentyONE System Check
======================

System Requirements
✅ PHP Version 8.3.0
✅ Magento Version 2.4.8
✅ PHP Memory Limit 2G

API Connection
✓ Connection test successful! Found 2 webstore(s).

Summary
✓ All checks passed!

Learn more: Connection Testing →

Connection Test

Test API connection without full system check:

bin/magento plenty:client:test

Client Token Management

Generate or refresh OAuth access token:

# Generate new token
bin/magento plenty:client:token

# Force refresh token
bin/magento plenty:client:token --refresh

Setup Wizards

Interactive setup wizards for initial configuration:

# Client connection and API configuration
bin/magento plenty:client:wizard

# Profile system setup
bin/magento plenty:profile:wizard

Client Wizard guides you through:

  1. Core settings (log rotation, notifications)
  2. REST API settings (timeout, retry logic)
  3. Client connection (URL, credentials, connection test)

Profile Wizard guides you through:

  1. Profile settings (history retention)
  2. Notification settings (log level, retention)
  3. Email alerts (recipients, thresholds)
  4. Performance settings (batch sizes, async processing)

Setup Commands

Complete Setup

Master command that runs both collection and property creation:

# Complete setup for all modules
bin/magento plenty:setup:init

# Setup specific modules only
bin/magento plenty:setup:init --modules=order,item,stock

# Preview what will be done (dry run)
bin/magento plenty:setup:init --dry-run

# Skip configuration collection
bin/magento plenty:setup:init --skip-collect

# Skip property creation
bin/magento plenty:setup:init --skip-create

Learn more: Profile Setup & Auto-Configuration →

Configuration Collection

Collect configuration data from PlentyONE API:

# Collect all configuration types
bin/magento plenty:setup:collect

# Collect specific types
bin/magento plenty:setup:collect --type=referrer,shipping,vat

# List available collectors
bin/magento plenty:setup:collect --list

What gets collected:

  • Referrers (order sources)
  • Shipping countries and profiles
  • VAT configurations
  • Web stores and locations
  • Item configuration (availabilities, barcodes, units)
  • Customer classes
  • Warehouse configurations

Property Creation

Create system properties in PlentyONE:

# Create all system properties
bin/magento plenty:setup:create

# Create specific property types
bin/magento plenty:setup:create --type=referrer,order,item

# List available property managers
bin/magento plenty:setup:create --list

# Verbose output
bin/magento plenty:setup:create --verbose

What gets created:

  • Default referrer (magento)
  • Media type referrers (image, small_image, thumbnail, etc.)
  • Order properties
  • Customer properties
  • Item property groups

Item (Product) Commands

Item Import

Import products from PlentyONE to Magento:

# Import all products via profile
bin/magento plenty:item:import --profile=<profile_id>

# Import specific item by PlentyONE ID
bin/magento plenty:item:import --id=12345

# Import items updated since date
bin/magento plenty:item:import --date-updated="2025-01-01"

# Verbose mode
bin/magento plenty:item:import --profile=1 --verbose

Item Export

Export products from Magento to PlentyONE:

# Export single product
bin/magento plenty:item:export --sku=TEST-SKU-001

# Export multiple products
bin/magento plenty:item:export --sku=SKU1,SKU2,SKU3

# Export by category
bin/magento plenty:item:export --category=10

# Export updated since date
bin/magento plenty:item:export --date-updated="2025-01-01"

# Export with profile
bin/magento plenty:item:export --profile=2 --verbose

Item Collection

Collect item data from PlentyONE:

# Collect items
bin/magento plenty:item:collect --profile=<profile_id>

# Collect specific items
bin/magento plenty:item:collect --id=12345,12346

# Collect by date range
bin/magento plenty:item:collect --date-created="2025-01-01/2025-01-31"

Item-Product Mapping

Manage mappings between PlentyONE items and Magento products:

# Create/update item-product mappings
bin/magento plenty:item:map

# Clear all mappings
bin/magento plenty:item:clear-mapping

Resolve Variation Visibility

Resolve which product variations should be visible in catalog:

bin/magento plenty:item:resolve-variation-visibility

Item Setup Commands

# Complete item module setup
bin/magento plenty:item:setup:init

# Collect item configuration data
bin/magento plenty:item:setup:collect

# Create item properties
bin/magento plenty:item:setup:property

Item Maintenance

# Clear item data
bin/magento plenty:item:flush-data

# Purge old item data
bin/magento plenty:item:purge --days=30

Order Commands

Order Export

Export orders from Magento to PlentyONE:

# Export by order entity ID
bin/magento plenty:order:export --id=123

# Export by increment ID (order number)
bin/magento plenty:order:export --increment_id=000000123

# Export multiple orders
bin/magento plenty:order:export --increment_id=000000123,000000124

# Export by date
bin/magento plenty:order:export --date="2025-01-13"

# Export by status
bin/magento plenty:order:export --status=processing

# Export with profile
bin/magento plenty:order:export --profile=3 --verbose

Learn more: Order Synchronization Testing →

Order Import

Import order updates from PlentyONE:

# Import all collected orders
bin/magento plenty:order:import --profile=<profile_id>

# Import with verbose output
bin/magento plenty:order:import --profile=4 --verbose

Order Collection

Collect orders from PlentyONE:

# Collect all updated orders
bin/magento plenty:order:collect

# Collect specific order
bin/magento plenty:order:collect --id=12345

# Collect by creation date
bin/magento plenty:order:collect --date-created="2025-01-01"

# Collect by update date
bin/magento plenty:order:collect --date-updated="2025-01-01/2025-01-31"

# Collect with profile
bin/magento plenty:order:collect --profile=4

Order Validation

Validate order data before export:

bin/magento plenty:order:validate --id=<order_id>

Order Mapping

Create/update order relation mappings:

bin/magento plenty:order:map

Order Deletion (Testing)

Delete test orders from PlentyONE:

# Delete order
bin/magento plenty:order:delete --id=<plenty_order_id>

# Delete payment
bin/magento plenty:order:payment:delete --id=<payment_id>

Order Maintenance

# Refresh order grid data
bin/magento plenty:order:refresh-grid

# Clear order data
bin/magento plenty:order:flush-data

Order Setup Commands

# Complete order setup
bin/magento plenty:order:setup:init

# Collect order configuration
bin/magento plenty:order:setup:collect

# Create order properties
bin/magento plenty:order:setup:property

Stock Commands

Stock Import

Import stock levels from PlentyONE:

# Import all stock
bin/magento plenty:stock:import --profile=<profile_id>

# Import with verbose output
bin/magento plenty:stock:import --profile=5 --verbose

Stock Collection

Collect stock data from PlentyONE:

# Collect all stock
bin/magento plenty:stock:collect --profile=<profile_id>

# Collect for specific SKUs
bin/magento plenty:stock:collect --sku=SKU1,SKU2,SKU3

Stock Source Management

Assign stock sources (MSI):

# Assign stock source to product
bin/magento plenty:stock:assign-source --sku=TEST-SKU --source=default

# Batch assign
bin/magento plenty:stock:assign-source --category=10 --source=warehouse1

Check Product Saleable Quantity

bin/magento plenty:stock:get-saleable-qty --sku=TEST-SKU

Stock Cleanup

# Clean up orphaned stock records
bin/magento plenty:stock:cleanup-orphaned

# Clean up reservations
bin/magento plenty:stock:cleanup-reservations

# Clean up unassigned reservations
bin/magento plenty:stock:cleanup-unassigned-reservations

# Resolve order inconsistencies
bin/magento plenty:stock:resolve-order-inconsistency

# Resolve shipment inconsistencies
bin/magento plenty:stock:resolve-shipment-inconsistency

# Flush import listing
bin/magento plenty:stock:flush-import-listing

Stock Setup Commands

# Collect stock configuration
bin/magento plenty:stock:setup:collect

Category Commands

Category Import

Import categories from PlentyONE:

# Import all categories
bin/magento plenty:category:import --profile=<profile_id>

# Import with verbose output
bin/magento plenty:category:import --profile=6 --verbose

Category Export

Export categories from Magento to PlentyONE:

# Export all categories
bin/magento plenty:category:export --profile=<profile_id>

# Export specific category
bin/magento plenty:category:export --id=<category_id>

# Export with verbose mode
bin/magento plenty:category:export --profile=6 --verbose

Category Collection

Collect category data from PlentyONE:

# Collect categories
bin/magento plenty:category:collect --profile=<profile_id>

# Collect specific categories
bin/magento plenty:category:collect --id=10,11,12

Category Path Building

Build category path hierarchy:

bin/magento plenty:category:build-path

Category Export Queue

Add categories to export queue:

bin/magento plenty:category:add-to-export-queue --id=<category_id>

Category Maintenance

# Clear category data
bin/magento plenty:category:flush-data

Customer Commands

Customer Export

Export customers from Magento to PlentyONE:

# Export single customer
bin/magento plenty:customer:export --id=<customer_id>

# Export multiple customers
bin/magento plenty:customer:export --id=1,2,3

# Export with profile
bin/magento plenty:customer:export --profile=7 --verbose

Customer Import

Import customers from PlentyONE:

# Import all customers
bin/magento plenty:customer:import --profile=<profile_id>

# Import with verbose output
bin/magento plenty:customer:import --profile=8 --verbose

Customer Collection

Collect customer data from PlentyONE:

# Collect contacts (customers)
bin/magento plenty:customer:collect-contact --profile=<profile_id>

# Collect addresses
bin/magento plenty:customer:collect-address --profile=<profile_id>

# Collect specific contacts
bin/magento plenty:customer:collect-contact --id=12345

Customer Maintenance

# Clear customer data
bin/magento plenty:customer:flush-data

Customer Setup Commands

# Complete customer setup
bin/magento plenty:customer:setup:init

# Collect customer configuration
bin/magento plenty:customer:setup:collect

# Create customer properties
bin/magento plenty:customer:setup:property

Attribute Commands

Attribute Export

Export product attributes to PlentyONE:

# Export all attributes
bin/magento plenty:attribute:export

# Export specific attributes
bin/magento plenty:attribute:export --attribute=color,size

# Export with verbose mode
bin/magento plenty:attribute:export --verbose

Manufacturer Export

Export manufacturers/brands:

bin/magento plenty:attribute:export-manufacturer

Attribute Collection

Collect attribute data from PlentyONE:

# Collect all attributes
bin/magento plenty:attribute:collect

# Collect manufacturers
bin/magento plenty:attribute:collect-manufacturer

Attribute Maintenance

# Clear attribute data
bin/magento plenty:attribute:flush-data

Property Commands

Property Import

Import properties from PlentyONE:

# Import all properties
bin/magento plenty:property:import --profile=<profile_id>

# Import with verbose output
bin/magento plenty:property:import --profile=9 --verbose

Property Export

Export properties to PlentyONE:

# Export properties
bin/magento plenty:property:export --profile=<profile_id>

# Export property groups
bin/magento plenty:property:export-group

Property Collection

Collect property data:

# Collect properties
bin/magento plenty:property:collect --profile=<profile_id>

Create Attribute Set Property

Create properties for attribute sets:

bin/magento plenty:property:create-attribute-set-property

Property Maintenance

# Clear property data
bin/magento plenty:property:flush-data

Referrer Commands

Create Referrer

Create order referrer in PlentyONE:

# Create default referrer
bin/magento plenty:client:create-referrer

# Create specific referrer
bin/magento plenty:client:create-referrer --name="magento" --type=1

Create Media Referrer

Create media type referrers:

bin/magento plenty:client:create-referrer-media

Profile Management Commands

Profile Configuration Export/Import

# Export profile configuration
bin/magento profile:export:config --profile=<profile_id>

# Export all profiles
bin/magento profile:export:config --profile=all

# Import profile configuration
bin/magento profile:import:config --file=config.json

Profile Data Purge

# Purge profile data
bin/magento profile:purge --profile=<profile_id>

# Purge all profile data
bin/magento plenty:profile:purge-data

# Purge old data (older than X days)
bin/magento profile:purge --days=30

Logging Commands

Log Collection

# Collect API logs
bin/magento plenty:log:collect

# Collect with date filter
bin/magento plenty:log:collect --date="2025-01-01"

Log Processing

# Process and analyze logs
bin/magento plenty:log:process

# Process specific log types
bin/magento plenty:log:process --type=error

Notification Commands

Send Batch Emails

Send profile notification emails:

# Send batch email notifications
bin/magento profile:notification:send-batch

# Send for specific profile
bin/magento profile:notification:send-batch --profile=<profile_id>

Maintenance Commands

Flush Data

Clear module-specific data:

# Clear client data
bin/magento plenty:client:flush-data

# Clear item data
bin/magento plenty:item:flush-data

# Clear order data
bin/magento plenty:order:flush-data

# Clear customer data
bin/magento plenty:customer:flush-data

# Clear category data
bin/magento plenty:category:flush-data

# Clear attribute data
bin/magento plenty:attribute:flush-data

# Clear property data
bin/magento plenty:property:flush-data

Clean Static View Files

# Clean static view files
bin/magento core:clean-static-view-files

Testing & Development Commands

Generate Fake Data (Development)

# Generate fake customers
bin/magento faker:generate:customers --count=100

# Generate fake orders
bin/magento faker:generate:orders --count=50

Common Command Patterns

Verbose Mode

Add --verbose or -v to most commands for detailed output:

bin/magento plenty:order:export --id=123 --verbose

Profile Selection

Most domain commands support profile selection:

--profile=<profile_id>  # Use specific profile
-p <profile_id> # Short form

Date Filters

Commands support various date filters:

--date="2025-01-13"                  # Specific date
--date="2025-01-01/2025-01-31" # Date range
--date-created="2025-01-01" # Creation date
--date-updated="2025-01-01" # Update date

ID Filters

--id=123               # Single ID
--id=123,124,125 # Multiple IDs

Command Chaining

Chain commands for complex workflows:

# Complete sync workflow
bin/magento plenty:category:import && \
bin/magento plenty:attribute:import && \
bin/magento plenty:item:import && \
bin/magento plenty:stock:import

# Export with validation
bin/magento plenty:order:validate --id=123 && \
bin/magento plenty:order:export --id=123

Tips & Best Practices

  1. Use verbose mode during testing: -v or --verbose
  2. Start with small batches: Test with single items before bulk operations
  3. Check logs: Always monitor var/log/plenty_*.log files
  4. Use dry-run when available: Preview operations before execution
  5. Profile-specific commands: Always specify --profile for multi-profile setups
  6. Background execution: Use & for long-running commands in production

Pro Tip: Use bin/magento list plenty to see all available Mage2Plenty commands with descriptions.