Storefront API / Shopify-Buy SDK - Applying Buy X get Y automatic discounts?

Hi! I do have a custom storefront built with Gatsby and I am curious if it is possible to apply automatic discounts with the Shopify-Buy sdk? So if Client X adds 3 of the same items in their cart, it will apply a % discount on that line item. Could someone help me with this? :slightly_smiling_face: