importing images into WooCommerce using cron
-
We are using WP All Import to import around 4800 products from XML into WooCommerce.
The process is following:
Customer loads images + xml file containing product data and image name to FTP server and we run WPAI in this folder to import everything. This process happens daily.
In case there are no images for certain products we are using predefined placeholder. We are using Default featured image for that
In the beginning we used manual run, when we launched import from WP All Import settings everything seems to be ok. Last week we introduced cron and we tried that couple of times. And with cron we faced following issue:
Default image was added to every product even already containing an image. If I open any product, I can see the placeholder being used as the main image, and the real image was used as an additional image.
Here how our shop looks after cron (blue logo is a placeholder that we set in Default featured image):
https://www.dropbox.com/s/gwpb435p3vckbtz/products.jpg
https://www.dropbox.com/s/0lsl8tkkw8hgx9q/single.png
Here are cron commands, just for your reference:
=====
We spoke with WP All Import team and here is their response:
======
I performed some tests with your plugin Default featured image, and I’m seeing that images are not assigned as a featured image when this plugin is active and the import is run via a Cron Job. If you disable that plugin, then images are imported correctly.
This issue seems to happen because Cron Jobs are run under an anonymous user.
To test, I modified line 68 from that plugin (default-featured-image/set-default-featured-image.php) and removed this admin validation: https://d.pr/i/Y1A2bW. Now it seems that featured images are being imported correctly via Cron Jobs.
That said, I’d recommend getting in touch with that plugin’s developer to see if this modification is valid or if there’s a better way to avoid this behaviour.
Hopefully, that helps, but let us know if you have any other questions.
The page I need help with: [log in to see the link]
- The topic ‘importing images into WooCommerce using cron’ is closed to new replies.