Hide multilevel price when promotion price is cheaper

Create logic that sets a variable when there is promotion prices that are a better deal then the bulk prices in order to hide the bulk prices for a better webstore experience.


Preparation Checklist

Before you start this tweak, it's a good idea to run through our preparation checklist below:

  • Read through the Getting Started to get a better sense of how the control panel, Database and Front End store interact.
  • Learn our recommended Simple Workflow. This makes the implementation process as easy as possible.
  • Create a new Staging Theme for this tweak. This allows you to preview any changes before they are visible to live customers.
  • The code snippet in this tweak doc uses Bootstrap 3, you may need to alter this code depending on what version of Bootstrap your theme is using. You can find out what version your theme is using here.

Coding Instructions

Insert the code below, the first set tag is creating the logic to read if there is a promo price cheaper than the bulk options then the tag that follows is the logic that determines if it should be displayed, the regular format for a multilevel pricing table and extra logic that shows the promo price in each individual case where it may be cheaper than the bulk price.

Open /products/includes/buyingoptions.template.html and replace the multielevel pricing table with the code below:

[%set [@hidevolumeprice@] %]
    [%format type:'text' trim:'a'%]
        [%multilevelpricing id:'[@SKU@]'%]
            [%param *body%]
                [%if [@promo_price@] <= [@price@] AND [@promo_price@] != 0%]
                [%else%]
                    FALSE
                [%/if%]
            [%/param%]
        [%/multilevelpricing%]
    [%/format%]
[%/set%]

[%if [@hidevolumeprice@] ne '' %]
    [%multilevelpricing id:'[@SKU@]'%]
        [%param *header%]
            <div class="row extras volumediscounts">
                <div class="col-xs-12">
                    <label>Buy In Bulk & Save!</label>
                </div>
                <div class="col-xs-12 alternating-table">
                    <table class="table">
                        <tbody>
        [%/param%]
        [%param *body%]
                        [%if [@promo_price@] <= [@price@] AND [@promo_price@] != 0%]
                            <!-- hide individual volume discount range if sale price is cheaper -->
                        [%else%]
                            <tr>
                                <td>
                                    Buy [%format type:'number' dp:'0' sp:','%][@minqty@][%/format%]
                                    [%if [@maxqty@] > 0%]
                                        to [%format type:'number' dp:'0' sp:','%][@maxqty@][%/format%]
                                    [%else%]
                                        or more
                                    [%/if%]
                                </td>
                                <td>
                                    Pay [%format type:'currency'%][@price@][%/format%]
                                </td>
                            </tr>
                        [%/if%]
        [%/param%]
        [%param *footer%]
                        </tbody>
                    </table>
                </div>
            </div>
        [%/param%]
    [%/multilevelpricing%]
[%/if%]

Was this article useful?

Be notified when this page is updated. Optional.