We've recently activated the PayPal payment solution on our Magento 2.3.4 site, with the in-context checkout experience enabled, and we are having an issue with the PayPal button on the product page. When we click on the button, we see the PayPal in-context checkout window briefly appear, then disappear, and then the product page refreshes to show that the item has been added to the cart. All of the other PayPal buttons on the site work properly (cart, checkout, etc), and we are able to use the in-context checkout to pay via PayPal. Just seeing this weirdness with the product page button.
Any thoughts on why this might be happening?
It can be because of your custom js code, you can just simply switch your theme to LUMA and verify if still occurring on that, if No, then you have to debug in your theme.
Hope you get the point.
I switched to the default LUMA theme, and the problem went away. How do I figure out what part of my custom theme code is causing the issue?
That can be tricky as the page reload with any error, you have to check what event is triggering when you click the button, it check if any other event is triggering with that button, you can also contact the theme vendor for support as they must know about this.
Hope it helps !