• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

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