Using twig|without for a commerce product

by Patrick Kenny   Last Updated November 13, 2017 17:07 PM

I have a twig template for my commerce product, commerc-product--contenttype.html.twig:

<article{{ attributes }}>
  <div class="row">
    <div class="col-xs-6">
      {{ product.field_price_original }}
      {{ product.variation_price }}
    </div>
    <div class="col-xs-6">
      {{ product.field_discount_percentage }}
    </div>
  </div>
  {{ product|without('variation_attributes', 'product.field_price_original', 'product.variation_price', 'product.field_discount_percentage') }}
</article>

I want to print three fields separately first and then print the rest of the content except for the first three fields (which have already been printed).

However, even though this note implies that without can take multiple values, everything is being printed; the without is ignored.

If I try a single value like this:

  {{ product|without('product.field_price_original') }}

The without is still ignored. What might be the cause of this?

Drupal 8.4 and Commerce 2.1



Related Questions


Find number of downloads in drupal commerce

Updated July 14, 2015 14:03 PM

Add multiple cart in drupal 7

Updated August 15, 2015 17:03 PM