PowerShell module for managing the WooCommerce shop system
For detailed API reference, see the WooCommerce API documentation.
First, you'll need an API key from your WooCommerce account:
- Log in to your WooCommerce admin dashboard.
- Navigate to WooCommerce > Settings > Advanced > REST API.
- Click on "Add Key".
- Fill in the description, select the user, and set permissions to "Read/Write".
- Click "Generate API Key" and note down the Consumer Key and Consumer Secret.
- Use these credentials to connect to the WooCommerce API from PowerShell.
- You can use the
Connect-WooCommercefunction to establish a connection using your API credentials.
Example:
$ConnectParams = @{
ConsumerKey = "your_consumer_key"
ConsumerSecret = "your_consumer_secret"
StoreUrl = "https://yourstore.com"
}
Connect-WooCommerce @ConnectParams# Get a product by ID
Get-WooCommerceProduct -Id 123
# Create a new simple product with a regular price of 19.99.
$NewProductParams = @{
Name = "New Product"
Type = "simple"
RegularPrice = "19.99"
Description = "A new product description."
}
New-WooCommerceProduct @NewProductParams
