Custom Quantity Discount Box to Link with Shopify Discounts

Hi everyone,

I just had a question regarding a piece of code I was trying to put together to attempt to replace app solutions which limit our use of the native Shopify discount functionality.

It essentially has to operate as an information box, which displays discount data for a product. This is the code which I have used to generate the table on a trial item:

Minimum Qty Discount
Buy {{ discount.minimum_quantity }} {% if product.discounts.size > 0 %} {% for discount in product.discounts %} {{ discount.value | money }} {% endfor %} {% else %} No discount available {% endif %}

The result of this unfortunately returns a table with the text specified, however due to my limited knowledge of Liquid, I’m not sure my code is correct.

The discount codes are simply set up as Product Discounts to give a discount off a particular item for a 5+ quantity, and then another takes over for the 10+ quantity. These are set up as two seperate discount codes for these differing quantities. In addition to this, we have a great deal of other products which have more than just 5 and 10 as quantity breaks, some have up to 4 levels, so I’ve seen that I would need to use a Loop for this, but again, due to my limited knowledge of Liquid, I’m not sure if this is the way to go.

Any help is appreciated! Thank you.