sendsmaily / smaily-woocommerce-plugin

Smaily plugin for WooCommerce
GNU General Public License v3.0
3 stars 0 forks source link

cron: Abandoned Cart stops working with missing log write permissions #142

Open kaittodesk opened 4 days ago

kaittodesk commented 4 days ago

Abandoned Cart CRON job stops working when the plugin doesn't have enough permissions to create (or write to) smaily-cart.txt log file in /wp-content/plugins/smaily-for-woocommerce.

Steps for reproducing

  1. Setup a WooCommerce site with at least single product.
  2. Create two Customer user accounts with invalid email address (e.g. customer@smaily.sandbox, customer2@smaily.sandbox, etc.).
  3. Configure Smaily for WooCommerce plugin with Abandoned Cart functionality.
  4. Log in with the first Customer user and add a product to cart.
  5. Log in with the second Customer user and add a product to cart.
  6. Wait until configured Abandoned Cart cutoff time has passed (or force carts to abandoned state manually in smaily_abandoned_cart table).
  7. Run smaily_cron_abandoned_carts_email CRON job.

Expected behavior API request to trigger abandoned cart automation is executed for both carts.

Actual behavior API request triggering abandoned cart automation is only executed for one of the carts.

Version information WordPress 6.6.2 WooCommerce 9.3.3 Smaily for WooCommerce 1.11.2

kaittodesk commented 4 days ago

I think the most reasonable solution would be to replace custom file log writing with error_log function which is also mentioned in Debugging in WordPress article.