Skip product if no image
-
What is wrong with that code?
add_filter(‘wp_all_import_is_post_to_create’, ‘skip_product_if_no_image’, 10, 3);
function skip_product_if_no_image($continue_import, $data, $import_id) {
if ($import_id == 1) {
error_log(‘Image link data received: ‘ . $data[‘image_link’]); // Log the image URL data
if (empty($data[‘image_link’])) {
error_log(‘No image found, skipping import for this product.’); // Log if no image is found
return false;
}
}
return $continue_import;
}
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Skip product if no image’ is closed to new replies.