Answers.Body: <p>Commerce 1:</p>
  
  <pre><code>{% set paymentMethod = null %}
  {% for pm in craft.commerce.paymentMethods %}
      {% if pm.id == 2 %}{% set paymentMethod = pm %}{% endif %}
  {% endfor %}
  
  {{ paymentMethod.name }}
  </code></pre>
  
  <p>Commerce 2:</p>
  
  <p><code>{{ craft.commerce.gateways.getGatewayById(2).name }}</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-29T06:54:06.857Z
Answers.Text: For Commerce 1, it only seems to work for payment methods that are available for checkout.  Is there a way to query methods that are not available for checkout?
Answers.UserDisplayName: biko
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-30T00:40:24.677Z
Answers.Text: Unfortunately not
Answers.UserDisplayName: Luke Holder
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-29T01:58:18.827Z
Answers.LastActivityDate: 2018-08-29T01:58:18.827Z
Answers.UserDisplayName: Luke Holder
Body: <p>In Craft 2, is it possible to query a specific element by ID in Twig?  They aren't mentioned in the docs.</p>
  
  <p>I was trying things like these but without success:</p>
  
  <pre><code>{{ craft.commerce.paymentMethods.id(1).name }}
  </code></pre>
  
Tags: <templating><plugin-craftcommerce><query><payment-methods><discounts>
Title: Payment Method and Discount elements query by ID in Twig
ThreadText: # Payment Method and Discount elements query by ID in Twig
  
  (Asked by: username_0 on 2018-08-29)
  
  In Craft 2, is it possible to query a specific element by ID in Twig? They aren't mentioned in the docs.
  
  I was trying things like these but without success:
  
  ```
  {{ craft.commerce.paymentMethods.id(1).name }}
  
  ```
  
  **Tags:** templating, plugin-craftcommerce, query, payment-methods, discounts
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-08-29. Score: 2 | Accepted answer
  
  Commerce 1:
  
  ```
  {% set paymentMethod = null %}
  {% for pm in craft.commerce.paymentMethods %}
      {% if pm.id == 2 %}{% set paymentMethod = pm %}{% endif %}
  {% endfor %}
  
  {{ paymentMethod.name }}
  
  ```
  
  Commerce 2:
  
  `{{ craft.commerce.gateways.getGatewayById(2).name }}`
  
  > **Comments:**
  > **username_0**: For Commerce 1, it only seems to work for payment methods that are available for checkout.  Is there a way to query methods that are not available for checkout?  
  > **username_1**: Unfortunately not  
  
  ---
  
  