switch product-page variant check js to a function