plugins-wp/wp-product-importer/readme.md

41 lines
1.5 KiB
Markdown

- Run cron
<!-- Run simple -->
<!-- Cron run import product -->
wp cron event run wpi_import_products_cron --allow-root <!-- Call by cron -->
wp eval "do_action('wpi_import_products_cron');" --allow-root <!-- Call by CLI -->
wp eval "do_action('wpi_import_products_cron', ['worker' => 1]);" --allow-root <!-- Run with workers -->
<!-- Cron sync categories -->
wp cron event run wpi_sync_categories_cron --allow-root <!-- Call by cron -->
wp eval "do_action('wpi_sync_categories_cron');" --allow-root <!-- Call by CLI -->
<!-- Cron triger auto sync -->
wp cron event run wpi_trigger_import_cron --allow-root <!-- Call by cron -->
wp eval "do_action('wpi_trigger_import_cron');" --allow-root <!-- Call by CLI -->
<!-- Cron run workers -->
wp cron event run wpi_dispatch_import_workers --allow-root <!-- Call by cron -->
wp eval "do_action('wpi_dispatch_import_workers');" --allow-root <!-- Call by CLI -->
- Run Cron tabs
0 2 \* \* \* cd /var/www/html && wp cron event run wpi_trigger_import_cron --allow-root >> /var/log/wp-trigger-import.log 2>&1
- - - - - cd /var/www/html && wp cron event run wpi_import_products_cron --allow-root >> /var/log/wp-import-products.log 2>&1
- CLI WP
# Xoá toàn bộ products
wp --allow-root post delete $(wp --allow-root post list --post_type=product,product_variation --format=ids) --force
# Cài WP CLI
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp