Re: Paypal Pay in 3 Not Updating Variants

Paypal Pay in 3 Not Updating Variants

JordanGBS
Visitor
2 0 0

I added the paypal pay in 3 messaging integration onto my product page via Custom Liquid, but when you choose a variant option, and the price increases, the price doesn't increase with the paypal messaging? It just stays the same. How can I fix this so it calculates and changes the price when you choose a variant?

Screenshot 2024-10-30 at 19.37.46.png

Reply 1 (1)

DaisyVo
Shopify Partner
3688 402 488

Hi @JordanGBS 

 

To make the PayPal Pay in 3 messaging update dynamically when a variant is selected, you’ll need to use JavaScript to refresh the PayPal widget each time the product variant changes.

  1. Add an onchange event listener to your variant selector to detect changes.
  2. Use PayPal’s JavaScript SDK to re-render the messaging with the updated price.

Here’s a basic example:

document.querySelector('#variant-selector').addEventListener('change', function() {

   paypal.Messages().render('#paypal-messaging-element');

});

Ensure to replace #variant-selector and #paypal-messaging-element with your actual element IDs.

 

If you have other questions, I am willing to answer them more.

 

Best regards,

Daisy

Please let us know if our reply is helpful by giving it a Like or marking it as a Solution!

Avada SEO & Image Optimizer - The #1 SEO solution