• Resolved koivunahka

    (@koivunahka)


    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;
    }


    • This topic was modified 7 months ago by koivunahka.
    • This topic was modified 7 months ago by koivunahka.
Viewing 1 replies (of 1 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hi @koivunahka,

    We can’t help with custom code, but the things I would check are:

    • Make sure the import ID check is using the right import ID (right now it’s checking for import ID 1).
    • Make sure the import element that contains the image is {image_link[1]}.

    If that doesn’t help, we will leave the thread open for a while to see if anyone would be willing to help out with the code.

Viewing 1 replies (of 1 total)
  • The topic ‘Skip product if no image’ is closed to new replies.