Bulk Pricing Discount Tables

If you're using the Bulk Discounts APP then you may want to display, on your product pages, a table (or tables) that display the bulk discounts that you offer, as shown in the example below.

If you sell a product that has variations, and you set different prices for the variations (and so different bulk discounts are applicable) then you can display multiple tables on the product page - one for each variation.


Installing the extension

Select 'apps and extensions' from the left menu and then 'available extensions'. Find the 'bulk pricing discount tables' extension and click to activate it on your account.

Once the extension is activated you'll then need to add the relevant code to your website's files (described below). Adding the code will add the tables to products that have bulk pricing discounts set. To add the relevant code you'll need to use the page editor, alternatively you can click the 'request installation' button and we'll install the code for you (a small charge will be made for the installation, which is listed on the extension page).

Self installation

1. Locate the product.twig file (located in /views/product pages/product.twig)

2. You'll need to add the code shown below where you would like to display the table

{% if product.bulk_prices %}
    <table>
        <h3>Bulk Buy Discounts</h3>
        <tr>
            <td>Quantity Purchased</td>
            <td>Price</td>
        </tr>
        {% for bulk_price in product.bulk_prices %}
            <tr>
                <td>{{ bulk_price.quantity }}</td>
                <td>{{ currency_value(bulk_price.value) }}</td>
            </tr>
        {% endfor %}
    </table>
{% endif %}

for example

This will display a table for bulk discount pricing on the product. If your product has variations, and you have set bulk pricing rules for the variations, then the table above will not display.

3. We recommend that you only add the code for the display of bulk discounts for variations if you have products that have variations and will be setting bulk pricing rules for them.

Here's the code

{% if product.bulk_variations %}
    {% for variation in product.bulk_variations %}
        <h3>{{ variation.title }}</h3>
        <table>
            <tr>
                <td>Quantity Purchased</td>
                <td>Price</td>
            </tr>
            {% for bulk_price in variation.prices %}
                <tr>
                    <td>{{ bulk_price.quantity }}</td>
                    <td>{{ currency_value(bulk_price.value) }}</td>
                </tr>
            {% endfor %}
        </table>
    {% endfor %}
{% endif %}

for example

You should put both the normal product discount table code and the product variation discount table code onto the page (not just the variation discount table code).

Please Note: The code above has no styling, so it will need to be styled (with CSS or inline styles) to display nicely.


Global bulk discounts

If you're setting bulk discounts for products as percentage discounts using the feature described in this help guide article, then to display a table containing these discounts you'll need to use the code shown below.

{% if product.bulk_discounts %} 
    <table> 
        <h3>Bulk Buy Discounts</h3>
        <tr>
            <td>Quantity Purchased</td>
            <td>Discount</td>
        </tr> 
        {% for discount in product.bulk_discounts %} 
            <tr> 
                <td>{{ discount.quantity }}</td> 
                <td>{{ discount.percent }}%</td> 
            </tr> 
        {% endfor %} 
    </table> 
{% endif %}

The {{ discount.percent }} variable will return the % discount, not the price of the product with the discount applied.

Please Note: As with the code further up this article, the above code above has no styling, so it will need to be styled (with CSS or inline styles) to display nicely.