Skip product imports if third product image is missing
-
Hello,
i’m importing products in the WooCo database where the products will only have the 3rd image in the ImageURL tag of the XML file as their featured image, i.e:
The XML export has the following products image tag
<ImageURL>
https://domain.com/wp-content/uploads/t-shirt-valholl-main.jpg|https://domain.com/wp-content/uploads/t-shirt-valholl-mockup.jpg|https://domain.com/wp-content/uploads/t-shirt-valholl-nobg.jpg
</ImageURL>i use [nobgImage({ImageURL[1]})] and the function
function nobgImage($imageUrl){ $nobgImages = explode('|', $imageUrl); return $nobgImages[2]; }to extract and assign the 3rd image as the products featured image
I need to skip any post import if there is no 3rd image in <ImageURL>, in other words if $nobgImages[2] is empty then skip this product import
Any help is greatly appreciated!
Best Regards,
JT
The topic ‘Skip product imports if third product image is missing’ is closed to new replies.