• The APS Catalog has been deprecated and removed from all Plesk Obsidian versions.
    Applications already installed from the APS Catalog will continue working. However, Plesk will no longer provide support for APS applications.
  • Please be aware: with the Plesk Obsidian 18.0.78 release, the support for the ngx_pagespeed.so module will be deprecated and removed from the sw-nginx package.

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