Answers.Body: <p>You <s>have to </s>can loop through the shipping rules for the shipping method.</p>
  
  <pre><code>{% for handle, method in cart.availableShippingMethods %}
  
    {% if method.shippingRules|length %}
      {% for shippingRule in method.shippingRules %}
        {{ shippingRule.name }}
        {{ shippingRule.description }}
      {% endfor %}
    {% endif %}
  
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-28T03:09:42.767Z
Answers.LastActivityDate: 2019-01-28T03:32:33.017Z
Answers.LastEditDate: 2019-01-28T03:32:33.017Z
Answers.UserDisplayName: Stephen Callender
Answers.Body: <p>calling </p>
  
  <pre><code>{% set methods = cart.availableShippingMethods %}
  </code></pre>
  
  <p>which is the same as calling:</p>
  
  <pre><code>{% set methods = craft.commerce.shippingMethods.getAvailableShippingMethods(cart) %}
  </code></pre>
  
  <p>the above returns an array of shipping method models, keyed by the shipping method handle. </p>
  
  <p>to get the matching rule for each available method</p>
  
  <pre><code>{% for method in methods %}
  {% set rule = method.getMatchingShippingRule(cart) %}
  {% set price = method.getPriceForOrder(cart) %}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-28T03:11:37.793Z
Answers.LastActivityDate: 2019-01-28T03:11:37.793Z
Answers.UserDisplayName: Luke Holder
Body: <p>I just noticed I had to update some templates after updating to the latest Commerce version (2.0.2).</p>
  
  <p>How does one go about getting the method's rule description?</p>
  
  <p>I currently have it set up to apply a rule based on geographical shipping location (like contiguous US states / Hawaii and Alaska / Russia / World / Oceania)—but <code>{{ method.description }}</code> from within <code>{% for handle, method in cart.availableShippingMethods %}</code> breaks the site.</p>
  
  <p>Cheers!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-27T22:09:26.150Z
Comments.Text: I would also want to display the rule name together with description. Right now it only displays the method name.
Comments.UserDisplayName: Anders
Tags: <craft3><plugin-craftcommerce2>
Title: Craft Commerce 2.0.2 Shipping Rule Names & Descriptions—How?
ThreadText: # Craft Commerce 2.0.2 Shipping Rule Names & Descriptions—How?
  
  (Asked by: username_0 on 2019-01-27)
  
  I just noticed I had to update some templates after updating to the latest Commerce version (2.0.2).
  
  How does one go about getting the method's rule description?
  
  I currently have it set up to apply a rule based on geographical shipping location (like contiguous US states / Hawaii and Alaska / Russia / World / Oceania)—but `{{ method.description }}` from within `{% for handle, method in cart.availableShippingMethods %}` breaks the site.
  
  Cheers!
  
  **Tags:** craft3, plugin-craftcommerce2
  
  > **Comments:**
  > **username_0**: I would also want to display the rule name together with description. Right now it only displays the method name.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2019-01-28. Score: 4 | Accepted answer
  
  calling
  
  ```
  {% set methods = cart.availableShippingMethods %}
  
  ```
  
  which is the same as calling:
  
  ```
  {% set methods = craft.commerce.shippingMethods.getAvailableShippingMethods(cart) %}
  
  ```
  
  the above returns an array of shipping method models, keyed by the shipping method handle.
  
  to get the matching rule for each available method
  
  ```
  {% for method in methods %}
  {% set rule = method.getMatchingShippingRule(cart) %}
  {% set price = method.getPriceForOrder(cart) %}
  {% endfor %}
  
  ```
  
  
  ---
  
  ### Answer by username_1 on 2019-01-28. Score: 4
  
  You ~~have to~~ can loop through the shipping rules for the shipping method.
  
  ```
  {% for handle, method in cart.availableShippingMethods %}
  
    {% if method.shippingRules|length %}
      {% for shippingRule in method.shippingRules %}
        {{ shippingRule.name }}
        {{ shippingRule.description }}
      {% endfor %}
    {% endif %}
  
  {% endfor %}
  
  ```
  
  
  ---
  
  