Hello there,
we hope you’re doing well!
Does this error appear if you remove the code?
Could you share the link to your site?
We will be attentive to your response.
Best regards.
Hi Juan,
The error is not caused by that snippet, I checked that. If I deactivate the plugin it disappears, but I think that is to be expected so I haven’t mentioned it. I’m using the full site editor if that’s of any matter.
Removing the ajax snippet for the wishlist link in header does nothing, except that the link is not working of course.. The problem with the snippet is that it should use ajax to update the count without the need of page refresh, if I understand it correctly.
Sorry, I can’t share a link to the website as it is still in development and there is no live/staging version, just a local one on my machine..
Hello there,
Regarding the cart error, is this a fatal error or is it just a warning? Do you have to add products from the cart to the wishlist? Could you tell us which option you have configured in Add to wishlist options > Loop settings > Position of ATW in loop?
On the other hand, I just tested the function to count the items in the wishlist via AJAX and it works correctly. Do you get any errors from the browser console with that fragment when adding an item to the wishlist?
We will be attentive to your response.
Best regards.
Hi Juan,
Firstly, sorry for the late responses, but there were a lot of holidays here and I was out of office.
The error is a warning, meaning that if I disable the WP_DEBUG it won’t be show, but never the less I wish that there are no errors/warnings when I submit the project to the client..
Checking the option “Position of ATW in loop” turned out to be pretty useful. I’m using “Use shortcode” as none of the other options is suits the design of the project. I changed it to “After Add to Cart button” and the error was gone, so I guess the problem is when the shortocde is used.. I’m adding the shortcode using the hook “woocommerce_after_shop_loop_item”. Checking at the WooCommerce docs this should be the correct one and should be for all pages with the loop.
Hello there,
Could you verify if the warning disappears by replacing the portion of code that is before the line where the error appears, with the following?:
switch ( $position ) {
case 'before_image':
$index = 1;
break;
case 'before_add_to_cart':
$index = 2;
break;
case 'after_add_to_cart':
$index = 3;
break;
default:
$index = 0;
break;
}
We will be attentive to your response.
Best regards.
Hi Juan,
Yes, that worked and the warning is gone. Thank you very much for all the assistance on this. Please note that only the default case was needed as the rest of the cases were already in the file. I will leave it like that. Maybe include this in future update of the plugin as there may be other people that will encounter the same warning, now that the full site editing in both WordPress and WooCommerce is getting more and more attention and usage. Thank you very much for all the help!
Hi there,
Perfect! We are glad of being able to help you 🙂
Please, do not hesitate to contact us again if needed.
Have a nice day!