Answers.Body: <p>James’s answer is correct, if there's only one list of items. I'm going to propose a derivative solution, in case you're dealing with an abstract set of elements (like a common pattern across many Products’ Variants).</p>
  <pre><code>{% set finishes = product.variants %}
  {% set powderCoatedSuffix = 'PC' %}
  
  &lt;ul&gt;
    {# Output the variants that *don't* end with `PC`: #}
    {% for variant in variants | filter(v =&gt; v.sku[-2:] != powderCoatedSuffix) %}
      &lt;li&gt;{{ variant.title }}: {{ variant.sku }}&lt;/li&gt;
    {% endfor %}
  
    {# Then, output those that *do*: #}
    {% for variant in variants | filter(v =&gt; v.sku[-2:] == powderCoatedSuffix) %}
      &lt;li&gt;{{ variant.title }}: {{ variant.sku }}&lt;/li&gt;
    {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  <p>The only trickery here is the short syntax for the <a href="https://twig.symfony.com/doc/3.x/filters/slice.html" rel="nofollow noreferrer"><code>slice</code></a> filter—in this case, taking the last two characters of the string.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-20T22:09:50.550Z
Answers.LastActivityDate: 2020-08-21T00:09:06.680Z
Answers.LastEditDate: 2020-08-21T00:09:06.680Z
Answers.UserDisplayName: August Miller
Answers.Body: <p>How would you like to identify that particular entry? If you're happy to hardcode its id, then I'd do it like this with the <a href="https://craftcms.com/docs/3.x/dev/filters.html#filter" rel="nofollow noreferrer">filter</a> filter and the <a href="https://craftcms.com/docs/3.x/dev/filters.html#without" rel="nofollow noreferrer">without</a> filter:</p>
  <pre><code>{% set allEntries = craft.entries.section('products').all() %}
  {% set pcEntry = allEntries|filter(item =&gt; item.id = 1234) %}
  {% set entriesWithoutPC = allEntries|without(pcEntry) %}
  </code></pre>
  <p>You can now output those however/wherever you like, e.g.</p>
  <pre><code>&lt;ul&gt;
    {% for product in entriesWithoutPC %}
      &lt;li&gt;{{ product.title }}&lt;/li&gt;
    {% endfor %}
    &lt;li&gt;{{ pcEntry[0].title }}&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-20T08:58:00.830Z
Answers.LastActivityDate: 2020-08-20T08:58:00.830Z
Answers.UserDisplayName: James Smith
Body: <p>I have a website where I want to show Power Coat (<code>-PC</code>) options <em>at the end of a list</em>. The data goes into Craft in an unpredictable order, from a third-party service, so I am responsible for organizing it in the front-end.</p>
  <p>Is there a way I can split out or force the <strong>-PC</strong> items to always appear at the end of the list, in my template?</p>
  <p><a href="https://i.sstatic.net/9KSUk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9KSUk.png" alt="enter image description here" /></a></p>
  
Tags: <templating><forloop>
Title: How can I ensure certain items always display at the end of a list?
ThreadText: # How can I ensure certain items always display at the end of a list?
  
  (Asked by: username_0 on 2020-08-19)
  
  I have a website where I want to show Power Coat (`-PC`) options *at the end of a list*. The data goes into Craft in an unpredictable order, from a third-party service, so I am responsible for organizing it in the front-end.
  
  Is there a way I can split out or force the **-PC** items to always appear at the end of the list, in my template?
  
  [![enter image description here](https://i.sstatic.net/9KSUk.png)](https://i.sstatic.net/9KSUk.png)
  
  **Tags:** templating, forloop
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-08-20. Score: 1
  
  username_2’s answer is correct, if there's only one list of items. I'm going to propose a derivative solution, in case you're dealing with an abstract set of elements (like a common pattern across many Products’ Variants).
  
  ```
  {% set finishes = product.variants %}
  {% set powderCoatedSuffix = 'PC' %}
  
  <ul>
    {# Output the variants that *don't* end with `PC`: #}
    {% for variant in variants | filter(v => v.sku[-2:] != powderCoatedSuffix) %}
      <li>{{ variant.title }}: {{ variant.sku }}</li>
    {% endfor %}
  
    {# Then, output those that *do*: #}
    {% for variant in variants | filter(v => v.sku[-2:] == powderCoatedSuffix) %}
      <li>{{ variant.title }}: {{ variant.sku }}</li>
    {% endfor %}
  </ul>
  
  ```
  
  The only trickery here is the short syntax for the [`slice`](https://twig.symfony.com/doc/3.x/filters/slice.html) filter—in this case, taking the last two characters of the string.
  
  
  ---
  
  ### Answer by username_2 on 2020-08-20. Score: 1
  
  How would you like to identify that particular entry? If you're happy to hardcode its id, then I'd do it like this with the [filter](https://craftcms.com/docs/3.x/dev/filters.html#filter) filter and the [without](https://craftcms.com/docs/3.x/dev/filters.html#without) filter:
  
  ```
  {% set allEntries = craft.entries.section('products').all() %}
  {% set pcEntry = allEntries|filter(item => item.id = 1234) %}
  {% set entriesWithoutPC = allEntries|without(pcEntry) %}
  
  ```
  
  You can now output those however/wherever you like, e.g.
  
  ```
  <ul>
    {% for product in entriesWithoutPC %}
      <li>{{ product.title }}</li>
    {% endfor %}
    <li>{{ pcEntry[0].title }}</li>
  </ul>
  
  ```
  
  
  ---
  
  