Buy X get Y - "discount code isn’t valid for the items in your cart"

I made a discount code for “buy x get y” with ‘spend a minimum of $50 (any products) and get 1 hat free’. Every time I try to test my code no matter what products I have in my cart I get a message saying “discount code isn’t valid for the items in your cart”.

I’ve triple-checked my code, I don’t see why it would say these items aren’t eligible when they’re all listed in the ‘customer spends’ section. Any ideas?

UPDATE: FIgured it out. The ‘y’ item is not automatically added. It must be in their cart in order for the discount code to work.

You need to check if you added the product that you will give in your sale. The Discount itsnt apply automatic with the code, you need to add the free product to the cart.