Julie here from Shopify Support.
I'm glad to hear that you're taking advantage of the discount code feature! Discount codes, especially Buy X, Get Y discounts, are excellent ways to boost sales.
If you haven't already done so, I suggest reviewing our help doc on Buy X, Get Y discounts. This help doc outlines exactly how you can create these types of discounts and it's a good idea to ensure you've followed each step correctly.
Based on the error message you're receiving, however, it sounds like there is an error within the Customer buys and Customer gets section of the discount over in Online store > Discounts. If you are trying to apply the discount code to a specific product(s), then you'll just need to ensure that you are adding the same product(s) to the cart.
If the discount is to be applied to products within a collection, on the other hand, then you'll just need to make sure that the product you're trying to add to the cart is included in the collection you selected when creating the discount code. You can confirm whether the product in question is included in the collection by heading to Products > Collections and heading into the same collection you selected when creating the discount code.
That being said, a screenshot of the discount you created would really help determine what's going on here. Since the issue seems to be product-related, you'll just need to make sure that the screenshot shows the Customer buys and Customer gets sections. Here's an example of the information I'll need to see:
I hope this helps lead you in the right direction, but if you're still experiencing issues with your discount code, feel free to send a screenshot my way; I'd be happy to further assist.
Looking forward to your response!
In shopify if you select Buy X get Y at first you need to select the minimum Quantity and on specific Products or Collection and viceversa were customer get what if he/she buy .So am sharing a app link were you can have Automatic Discount and Stack discount .
Am also sharing the app link: https://apps.shopify.com/discount-coupon-field-in-cart-page which your problem will sorted out.