jeffharrell / minicart

The minicart is a great way to improve your PayPal shopping cart integration.
MIT License
500 stars 209 forks source link

reset() on return from PayPal throws Uncaught TypeError #202

Closed krheinwald closed 10 years ago

krheinwald commented 10 years ago

HTML file given in cancel_return parameter of PayPal form.

HTML contains

<script src="//cdnjs.cloudflare.com/ajax/libs/minicart/3.0.3/minicart.min.js"></script>
<script>
            paypal.minicart.reset();
</script>

When this page is opened on return from PayPal, an exception is thrown and the cart is not cleared:

Uncaught TypeError: Cannot call method 'destroy' of undefined

jeffharrell commented 10 years ago

You'll need to make sure you'll calling render() first. I've updated the example at minicart.js to have proper cancel and and return URLs which cause a reset().

I think you actually raise an interesting issue though, and you shouldn't need to call render() before calling reset(). I'll keep this open for the time being as a reminder to look into that.

krheinwald commented 10 years ago

Doh! That did it! Thanks!

jaladuvar commented 10 years ago

I was struggling with the issue of not being able to clear the minicart any longer since sometime (not knowing why) and this saves my day..Trouble with being a newbie is that you never now if it's you or something else that creates the issue...Thanks for this great product...

jeffharrell commented 10 years ago

Closing this as resolved.

Oxdirect commented 9 years ago

I've been having exactly the same issue. Placing the render statement on the return page fixed it. Is there any chance of putting this fix on the homepage - I've spent hours getting this sorted.