after I put it in the footer, I can’t choose a variation on the product page also.
Thanks for your answer I put this code to cart.php and its dot helped