I have adjusters that dynamically add/remove costs to things like baseShippingCost and baseDiscount, and want to be able to specifically show the numbers for those adjusters on the cart page - not just the total baseDiscount or baseShippingCost number - as things like shipping costs, or coupons, are also bundled into those.

Here's the adjuster example from documentation, I'll use this as the example:

class BusinessLogic_TaxRemover implements Commerce_AdjusterInterface {

    public function adjust(Commerce_OrderModel &$order, array $lineItems = []){

    $myAdjuster = new Commerce_OrderAdjustmentModel();

    $order->baseDiscount = $order->baseDiscount - 5;

    $myAdjuster->type = "Tax Remover";
    $myAdjuster->name = "Australian GST Remover";
    $myAdjuster->description = "Removes the 10% GST";
    $myAdjuster->amount = -5.0;
    $myAdjuster->orderId = $order->id;
    $myAdjuster->optionsJson = ['lineItemsAffected'=>null];
    $myAdjuster->included = false;

    return [$myAdjuster];



How would I access the $myAdjuster->amount in the template/twig file for the order? I've tried {{ cart.myAdjusterName.amount }} and I simply get the error "Craft\Commerce_OrderModel and its behaviors do not have a method or closure named "myAdjusterName".

Does anyone know how to get this information? Any help would be great!

1 Answer 1


You can access each adjuster and its respective amount via the cart.adjustments tag. Here's the example supplied with the templates from the commerce plugin (commerce/cart.html):

{% for adjustment in cart.adjustments %}
        <td>{{ adjustment.type }}
        <td><strong>{{ adjustment.name }}</strong><br>({{ adjustment.description }})</td>
        <td class="text-right">{{ adjustment.amount|currency(cart.currency) }}</td>
{% endfor %}

If you have set the included attribute of your Adjuster to true then it won't show up as an adjuster but only affect the cart amounts outputted (such as baseShippingCost and baseDiscount) so if you have something similar to the above already, that's why it won't be displayed. You can read more about the included attribute here.

  • Gotcha - I did notice I could find them in cart.adjustments but hate that I'd have to loop through them just to print the ones I need. After looking around I'm guessing this is the only way to access them from the cart model. Thanks for pointing it out!
    – taylor
    Commented Oct 11, 2016 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.