Klaviyo Back in Stock button only appearing after refresh

Hi team,

I’m currenlty trying to implement the Klaviyo back in stock button. We’re using the Wookiee theme and finally managed to get the button to show up, but for some reason the button only displays after you refresh the product page.

https://www.potteryfortheplanet.com/collections/cups/products/desert-ochre-planet-cup?variant=29216652230774

This is the code snippet I used in the product-template.liquid:

Would someone be able to help me with this?

Cheers,

Andre