Refactor the js that gets the product variants array