• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

Question Is there a way to use the Woocommerce command line tools ('wp wc') with plesk ext wp-toolkit --wp-cli

wolfatadfilm

New Pleskian
There are a couple of tools that are helpful to run as a cron job, e.g. I could just run
wp wc tool run regenerate_product_lookup_tables

I know that each tool has a REST API equivalent but to run them a POST request is needed, so this doesn't work with CRON.
Do I need to write a script just to do such a simple call or is there a way to bind the wc commands into
plesk ext wp-toolkit --wp-cli ?
 
A surprisingly high number of users have viewed this question, but no answer so far, so I will just post the code for the quick script I put together. Maybe someone else finds it useful:

<?php require __DIR__ . '/vendor/autoload.php'; use Automattic\WooCommerce\Client; $woocommerce = new Client( 'https://your_server.com', 'ck_clientkey', 'cs_clientsecret', [ 'wp_api' => true, 'version' => 'wc/v3' ] ); print_r($woocommerce->put('system_status/tools/regenerate_product_lookup_tables',[])); ?>
Of course you need to
composer require automattic/woocommerce
and adapt the path and REST API auth credentials.
 
Back
Top