Jump to content

PayPal button on product page removes cart contents


Recommended Posts


We use Prestashop 1.7 with latest PayPal module version.

There is PayPal buy now button right next to the shopping cart on our product page.

The only problem is, it removes products existing in cart before opening checkout.


1. Customer has ProductA, ProductB, ProductC

2. goes to product page of ProductD

3. Clicks on add to cart on ProductD page.

4. Cart is emptied, checkout is opened only with ProductD.

Is there any way to stop PayPal from removing products from shopping cart?

I've noticed that PayPal button during checkout works perfectly fine. It created PayPal express window with all the products that were in shopping cart.

Link to comment
Share on other sites

  • 2 weeks later...



Thank you for your message.

When a customer purchases via PayPal button on a product sheet, the module only takes into account the product in question. This is an instant purchase that is done directly via the product sheet.

The behavior of the module is correct and complies with PayPal rules.

PayPal buy button can be also added to the shopping cart as well. In this case all products added to the cart will be taken into account.


Do not hesitate if you have any additional questions.

Have a nice day !

Link to comment
Share on other sites

I see how it works. Would in such case be possible to use shopping cart behaviour on product page?

When someone clicks Pay with Paypal, it first executes add to cart and then opens standard PayPal checkout window.

In fact, I tried to do it myself, but it seems to be impossible since PayPal button is displayed in an iframe and because of samesite policy it is impossible to execute events on elements displayed in iframe from another domain.

Do you offer customisation for that?

Link to comment
Share on other sites

  • 2 weeks later...




We are sorry but this behavior is recommended by PayPal.

PayPal shortcuts on product pages work well for the shops with mono product. It you have a large catalog it is better to disable shortcut on the product pages and keep it enabled only on the cart page and 1st step of the checkout.


Thank you for understanding.


Have a nice day !

Link to comment
Share on other sites

We created a workaround to this.


Now popup opens when someone clicks paypal/amazon button and there's more information there.

If cart is empty, the button shows notification to add products to shopping cart.

If cart is not empty, it opens a regular paypal checkout (the same as in cart/login page). Hopefully this will sort out the issue.

However we are facing another problem now.

Sometimes when the page is refreshed, PayPal button is just not loaded. No idea why this is happening, we also do same integration for amazon pay and all works great.

It happens that the button is not displayed until I press ctrl + F5.

What could be the reason of that happening? maybe I should move the module to the very top or very bottom in the hook list?

Can it be caused by cache module?

Link to comment
Share on other sites

  • 1 month later...

@202 ecommerce could you help me on fixing the issues related to PayPal module for PS 1.7 please?

We use latest PayPal module 5.4.4 and we have PS 1.7.6.

We get the following errors with PayPal module enabled:

shortcut.js?v=5.4.4:formatted:86 Uncaught TypeError: prestashop.on is not a function
    at Object.init (shortcut.js?v=5.4.4:formatted:86)
    at waitPaypalIsLoaded (duschrinne-wiper-premium-600-mm-ponente:3180)

and another error:

Uncaught ReferenceError: jQuery is not defined
    at jquery-migrate-1.2.1.min.js:2

It is caused by PayPal JS being loaded too high in the site, before prestashop object is initialised.

Is there a way to push the PayPal to the bottom of the list of the loaded items? I think this would resolve both problems.


Edited by Jurist (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...