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?
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.
- Add an onchange event listener to your variant selector to detect changes.
- 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
