Best solution for updating pricing in Affirm's modal popup for variants?

Highlighted
New Member
9 0 0

We installed Affirm's App on our site but when you select a variant with a different price the new price doesn't show in Affirm's Modal Box. But if you reload the product page the modal will then show the correct price. One solution I found was to use the below script to reload the page when a variant is selected. But I tried this code by pasting it at the end of the product.liquid file (viewable in the link below) and it doesn't work? Do I first need to add a jquery library to theme.liquid head section? Also, is this actually a poor solution? I'm concerned this will negatively impact the shopping experience. Is the best solution to adjust the JavaScript on the site so it changes the value in Affirm's Modal as well. Thanks for any tips, suggestions and/or help.

https://gist.github.com/UPC278999/b674abfefcd6f82085311b4327f543e3

 

<script>
jQuery(function() {
$('.single-option-selector').on('change', function(){
setTimeout(function(){
if($('[name="id"]').val() != "{{ product.selected_or_first_available_variant.id }}"){
location.reload();
}
}, 1);
});
});
</script>

 

 

0 Likes