deleted items still showing in suggestions

  • ali.h@sela.ae
    Participant
    6 months, 1 week ago #29808

    Hello Team,
    when deleting items from woocommerce via
    wp_delete_post($id)
    OR
    $product = wc_get_product($id);
    $product->delete();
    The items still show in the suggestions dropdown without image or link, but it doesn’t show in search page.
    Suggestions

    • This topic was modified 6 months, 1 week ago by wpsolr.
    wpsolr
    Keymaster
    6 months, 1 week ago #29809

    Can you verify in your index that your product is no more there?

    ali.h@sela.ae
    Participant
    6 months, 1 week ago #29810

    Yes it is still in the index.
    Here is the screenshot of the response of a direct call to elastic search.
    Index not deleted

    wpsolr
    Keymaster
    6 months, 1 week ago #29811

    WPSOLR removes a post from the index when the WP ‘save_post’ hook is sent, for instance when a post is trashed.

    But I just noticed that wp_delete_post() does not send the hook ‘save_post’.
    To fix this issue, the hook ‘after_delete_post’ will be added on next WPSOLR release.

    For now, you could trash the product before deleting it to remove it from the index.

    Or change line 116 of file /wpsolr-pro/wpsolr/core/wpsolr_include.inc.php :

    
    add_action( 'save_post', 'add_remove_document_to_solr_index', 999, 3 );
    

    with:

    
    add_action( 'save_post', 'add_remove_document_to_solr_index', 999, 3 );
    do_action( 'after_delete_post', 'add_remove_document_to_solr_index', 10, 2 );
    
    • This reply was modified 6 months, 1 week ago by wpsolr.
    ali.h@sela.ae
    Participant
    6 months, 1 week ago #29813

    Thank you

    ali.h@sela.ae
    Participant
    6 months, 1 week ago #29815

    Hello Support
    This fix did not resolve the issue.
    Please help urgently we cannot delete the index every bit and reindex again, we have more than 500k items.

    ali.h@sela.ae
    Participant
    6 months ago #29861

    Additionally, even when a product is deleted or trashed from the dashboard, it does not get removed from the index.

    wpsolr
    Keymaster
    6 months ago #29862

    Additionally, even when a product is deleted or trashed from the dashboard, it does not get removed from the index.

    This error appeared after the custom code you just applied?

    ali.h@sela.ae
    Participant
    6 months ago #29863

    No, it was there even before.

    ali.h@sela.ae
    Participant
    6 months ago #29864

    There is another issue we also noticed when we first installed the plugin.
    we are using Dokan with woocommerce, when we disable a vendor, their products do not get removed from the index also. but I will open a separate thread for this as I need the check the status of products when the vendor is disabled

    wpsolr
    Keymaster
    6 months ago #29865

    WPSOLR will not work with Dokan. Only current extensions are supported.

    ali.h@sela.ae
    Participant
    6 months ago #29866

    Ok, what about the deleted items issue?

    wpsolr
    Keymaster
    6 months ago #29868

    Unfortunately, Dokan not being tested with WPSOLR, I cannot answer.

    ali.h@sela.ae
    Participant
    6 months ago #29870

    But delete is done from Woocommerce dashboard, and we are using WordPress’s (wp_delete_post and wp_trash_post) and Woocommerce’s ($product->delete()) core functionalities to delete products and it is not working

    wpsolr
    Keymaster
    6 months ago #29871

    Deactivate Dokan, and delete a product from the WooCommerce dashboard. Do you see the “Deleted from the index” message from WPSOLR?

Viewing 15 posts - 1 through 15 (of 27 total)

You must be logged in to reply to this topic.