@divspot Can you share the steps you take so I can replicate this? Because I am not seeing any issues on the frontend that this search plugin is designed for.
Hi Sébastien,
Certainly.
- Open https://isabellagarcia.co.za
- Add any item (from any page) to your cart (as a guest).
- Input a search keyword using the header “search icon”, await an AJAX response.
- Refresh the page or open a different page.
- Notice that the cart has been cleared.
If you look at the headers (as is provided with Chrome dev tools) you’ll be able to notice that it sends cookie data in the response that clears the cart.
Please let me know if you need more information.
Regards,
Estian
Hi Sébastien, @sebd86
For some additional information see below.
I’ve noted also that the AJAX search sends the correct WooCommerce cart data in the headers as it does when adding an item to the cart. I just don’t see what is different between an “add to cart” AJAX request and an AJAX “search” request in terms of the request data?
What is the purpose of the code in?
/includes/class-cocart-session-handler.php -> set_customer_cart_cookie())
When $set = false
the following is run:
// If cookies exists, destroy it.
if ( isset( $_COOKIE[ $this->_cookie ] ) ) {
$this->cocart_setcookie( $this->_cookie, '', time() - YEAR_IN_SECONDS, $this->use_secure_cookie(), $this->use_httponly() );
unset( $_COOKIE[ $this->_cookie ] );
}
This function is a twin of the WooCommerce class-wc-session-handler.php -> set_customer_session_cookie(...)
function, yet the WooCommerce function does not delete the cart on $set === false
.
Thank you for providing the steps. I was able to replicate the issue.
The purpose of destroying the cookie is for when a guest customer turns into a registered customer by authenticating. Without destroying the cookie first, the cart does not return correctly for the registered customer when the response returns.
This should not be affecting guest customers as the cookie is only destroyed first before creating a new one when a customer is authenticated.
I tested the steps locally with the free version of the plugin and there was no issue as a guest customer. The cart did not clear. The problem is with the Pro only so it might be best to ask them for support to find out what the difference is between the two search plugins.
Hi Sébastien @sebd86,
Thank you for your response & feedback.
I will look into the free version of the “Advanced Woo Search” plugin and test.
Unfortunately the plugin’s developer has not yet responded and we are a little stuck in the mud.
By looking at the AJAX search request headers I don’t understand why it would destroy the cart – it does indeed send cart data to the server.
I appreciate all of your assistance.
Regards,
Estian
Hi Sébastien Dumont (@sebd86),
My colleague and I have done additional testing on our side and have confirmed that with the CoCart Lite plugin enabled the Advanced Woo Search PRO version does “clear the cart“.
The issue here however is not that the Advanced Woo Search Pro is performing the clear but rather when the CoCart Lite plugin is enabled the plugin reports incorrectly that there are no items in the cart.
If I perform a search using Advanced Woo Search PRO with the CoCart Lite plugin disabled the plugin correctly indicates that there are items in the cart.
If however I enable the CoCart Lite plugin and perform the same search the response from that indicates that the cart was empty, there must be something in the CoCart Lite plugin that is altering this.
Please could you advise?
Thank you for your continued assistance.
Regards,
Estian
As I stated before @divspot
I tested your steps locally with the FREE version and was NOT ABLE to replicate the issue so there is a difference between the FREE and the PRO version of “Advanced Woo Search” plugin.
Which is why I said for you to contact the developers of Advanced Woo Search as you are a customer of theirs and should get support from them.
There is nothing in there documentation that explains to a developer how this can be triggered.
Until we are able to identify the difference between the two versions of the plugin I can’t help.
I certainly cannot alter set_customer_cart_cookie()
as it will break CoCart.
I hope the developers of “Advanced Woo Search” can give some insight and respond soon so that this issue can be resolved.
Sorry that I cannot be of much help at this time.
I have contacted the developers also and forwarded this issue.
Sébastien Dumont (@sebd86),
Thank you for your response.
I understand what you are saying – it is the PRO version causing the issue.
We’ve been busy investigating the code to try and find out why.
Unfortunately the plugin developer does not seem interested in responding.
Regards,
Estian
Let me know if the developer does respond and I will re-open this issue.
Sébastien Dumont (@sebd86),
The Advanced Woo Search PRO plugin developer has responded and advised how to fix the issue. He also noted that a future update will include the fix.
Thank you for all of your assistance.
Regards,
Estian
I’m glad the developer got back to you and that a fix is under way. 😀
Advanced Woo Search (Free) v2.26 includes a fix now so it is compatible with CoCart. I don’t know if the Pro version has a fix applied yet. Maybe you can tell me.
Thanks.
Sebastien Dumont @sebd86,
Thank you for your response.
I apologize for the very delayed response from my side.
The issue has been fixed for us.
This ticket can certainly be closed!
Thank you,
Estian