refactor repeated code for finding item in cart by variant_id