WC_CLI_COM_Command
in package
Allows to interact with extensions from WCCOM marketplace via CLI.
Tags
Table of Contents
- APPLICATION_PASSWORD_SECTION_URL = 'https://woocommerce.com/my-account/#application-passwords'
- connect() : void
- Connects to WooCommerce.com with application-password.
- disconnect() : void
- ## OPTIONS
- list_extensions() : mixed
- List extensions owned by the connected site
- register_commands() : mixed
- Registers a commands for managing WooCommerce.com extensions.
- ask() : string
- We are asking a question and returning an answer as a string.
Constants
APPLICATION_PASSWORD_SECTION_URL
public
mixed
APPLICATION_PASSWORD_SECTION_URL
= 'https://woocommerce.com/my-account/#application-passwords'
Methods
connect()
Connects to WooCommerce.com with application-password.
public
static connect(array<string|int, mixed> $args, array<string|int, mixed> $assoc_args) : void
[--password] : If set, password won't be prompt.
[--force] : If set, site will be disconnected and a new connection will be forced.
EXAMPLES
# Connect to WCCOM using password.
$ wp wc com connect
# force connecting to WCCOM even if site is already connected.
$ wp wc com connect --force
# Pass password to comman.
$ wp wc com connect --password=PASSWORD
Parameters
- $args : array<string|int, mixed>
-
Positional arguments to include when calling the command.
- $assoc_args : array<string|int, mixed>
-
Associative arguments to include when calling the command.
Tags
Return values
void —disconnect()
## OPTIONS
public
static disconnect(array<string|int, mixed> $args, array<string|int, mixed> $assoc_args) : void
[--yes] : Do not prompt for confirmation.
EXAMPLES
# Disconnect from site.
$ wp wc com disconnect
# Disconnect without prompt for confirmation.
$ wp wc com disconnect --yes
Parameters
- $args : array<string|int, mixed>
-
Positional arguments to include when calling the command.
- $assoc_args : array<string|int, mixed>
-
Associative arguments to include when calling the command.
Tags
Return values
void —list_extensions()
List extensions owned by the connected site
public
static list_extensions(array<string|int, mixed> $args, array<string|int, mixed> $assoc_args) : mixed
[--format] : If set, the command will use the specified format. Possible values are table, json, csv and yaml. By default the table format will be used.
[--fields] : If set, the command will show only the specified fields instead of showing all the fields in the output.
EXAMPLES
# List extensions owned by the connected site in table format with all the fields
$ wp wc com extension list
# List the product slug of the extension owned by the connected site in csv format
$ wp wc com extension list --format=csv --fields=product_slug
Parameters
- $args : array<string|int, mixed>
-
WP-CLI positional arguments.
- $assoc_args : array<string|int, mixed>
-
WP-CLI associative arguments.
Return values
mixed —register_commands()
Registers a commands for managing WooCommerce.com extensions.
public
static register_commands() : mixed
Return values
mixed —ask()
We are asking a question and returning an answer as a string.
protected
static ask(string $question) : string
Parameters
- $question : string
-
The question being prompt.