Notification Snippet To Count Shippings?

I'm trying to add a note in the customer order summary where if there are more than 1 shipping methods used in the order (bought from more than 1 supplier) the customer would get an included text that his order will be shipped in multiple packages

What I need to do is figure out how to count the # of entries in this variable

{{o.shippings_method}}

Currently the template will just list all methods used, is there a way to do something like this?

{% if o.shippings_method >1 %}
my custom text here
{% endif %}
this obviously does not work but how do you count the # of methods included?

Please try

https://twig.symfony.com/doc/3.x/filters/length.html

Perfect!

thanks so much for the help

I thought that worked until I tested it with an order with only 1 shipping method, for those interested here is what I did that worked

{% if o.shipping.1.shipping_id %}

{{ __("order_ships_multi_packages") }}

{% endif %}

what that does is look if there is a 2nd shipping id in the string, if so it displays the message text

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.