On our most of our default customer-facing documents, accessories that are set up as components are hidden from the customer. We do this using some Liquid syntax in the code of the document layout. It looks like this: 

{% if item.is_accessory? and item.accessory_mode_is_component? and item.charge_total == 0 %}
{% else %}
  ...
{% endif %}

This code tells Current RMS to print nothing when an item in the list is an accessory, its mode is component, and its charge total is 0.

You can use similar Liquid to hide or otherwise manipulate other items or groups in your documents.

This is an advanced tutorial for folk who like to dig into the HTML & CSS that makes up our documents. If that’s not you, don’t worry! We offer a free document layout modification service so we’re happy to do this for you.

What criteria can be used to hide items or groups?

Pretty much any attribute against an opportunity item or group can be used to hide or manipulate it on our documents. For example, you might like to hide:

Get started

Each layout is different, so the exact code you’ll need will vary depending on the document that you’re working on. In our standard quotations and rental agreements, you’ll want to add something in the order.items  loop, within the {% if item.is_item? %}  block. 

Use an unless  statement to filter out items based on the criteria you’d like to use to hide. For example, to filter out items that are zero priced:

{% unless item.charge_total == 0 %}
  ...
{% endunless %}

For example:

{% for item in order.items %}
  {% if item.is_subtotal? %}
      {% if item.depth == 1 %}
        <tr class="totals-row">
          <td class="align-right" colspan="6">Total for {{ item.subtotal_name }}:</td>
          <td class="align-right">{{ item.subtotal | currency }}</td>
        </tr>
      {% endif %}
    {% elsif item.is_group? %}
      <tr>
        <td colspan="7" style="padding-left: {{ item.depth_padding }}px;">
          <h4>{{ item.name }}</h4>
          {% if item.description != blank %}
            <p>{{ item.description | newline_to_br }}</p>
          {% endif %}
        </td>
      </tr>
    {% elsif item.is_item? %}
      {% unless item.charge_total == 0 %}
        {% if item.is_accessory? and item.accessory_mode_is_component? and item.charge_total == 0 %}
        {% else %}
          <tr>
            <td style="padding-left: {{ item.depth_padding }}px;" colspan="2">
              {{ item.name }}
              {% if item.is_accessory? %}
                <em>({{ item.accessory_mode_name }})</em>
              {% endif %}
            </td>
            <td>{{ item.transaction_type_name }}</td>
            <td class="align-center">
              {{ item.quantity | number }}
              {% if item.is_service? %}
                x
                {{ item.chargeable_days | number:0 }}
                {{ item.service_unit_name }}
              {% endif %}
            </td>
            <td class="align-right">{{ item.discounted_price | number:2 }}</td>
            <td class="align-right">{{ item.surcharge_amount | number:2 }}</td>
            <td class="align-right">{{ item.charge_total | number:2 }}</td>
          </tr>
        {% if item.description != blank %}
          <tr>
            <td style="padding-left: {{ item.depth_padding }}px;" colspan="6">{{ item.description | newline_to_br }}</td>
          </tr>
        {% endif %}
      {% endif %}
    {% endunless %}
  {% endif %}
{% endfor %}

Objects for hiding

Check out our Liquid objects guides for details of the objects you can use to hide items based on: Liquid objects

Some common objects:

  • items with a charge total of 0.00.
    {% unlesss item.charge_total == 0 %} 
  • items within a particular product group in Resources > Products
    {% unless item.product_group_name == "" %} 
  • items with a particular custom field value
    {% unless item.custom_field_name == "" %}
  • products with a particular custom field value
    {% unless item.product.custom_field_name == "" %} 

Need help?

Remember we offer a free document layout modification service, so we’re happy to help with document changes. Get in touch with us using the help bubble at the bottom-right if you need a hand  ↘️

Did this answer your question?