• 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!
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    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. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.

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