• Resolved ilyapokrov

    (@ilyapokrov)


    Good afternoon.
    Earlier, I asked you how to hide products from the catalog, but leave them visible for search if they were deleted from the vendor file.
    And you advised me to use this code:

    <?php
    function my_is_post_to_delete( $is_post_to_delete, $post_id, $import ) {
    // Unless you want this code to execute for every import, check the import id
    // if ( $import->id == 5 ) { … }
    if ( $product = wc_get_product( $post_id ) ) {
    $product->set_catalog_visibility( ‘hidden’ );
    $product->save();
    }
    return false;
    }
    add_filter( ‘wp_all_import_is_post_to_delete’, ‘my_is_post_to_delete’, 10, 3 );
    ?>

    It works great, thanks.
    But there is one problem: When the product appears again in the vender file, the statue does not change on my site and it still remains with the status of “Hidden”

    Please help to solve this problem?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ilyapokrov

    (@ilyapokrov)

    I found a problem. I forgot to specify in the settings that the goods that are present in the import file need to update catalog visibility.

    Thank)
    The plugin is really very useful and cool!

    Plugin Author WP All Import

    (@wpallimport)

    Hi @ilyapokrov,

    Thanks for the update, I’m glad you were able to sort it out!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘change in product status upon update’ is closed to new replies.