Handlebar works with some orders that has more than 2 items

Hey Celigo Team

am trying to process Orders for each scenario that happens in Shopify

The handlebar Works with some Orders some orders don't

The Handlebar
{{#if line_items[*].sku}}

{{line_items[*].sku}}{{else}}{{#contains line_items[*].title "Gift Card"}}

Gift Card

{{else}}

{{#contains line_items[*].name "Gift Wrap"}}

Gift Wrapping

{{else}}

{{#contains line_items[*].name "Custom Engraving"}}

Custom Engraving

{{else}}

{{#contains line_items[*].name "Custom Stone Count"}}

Inlay Birthstone Bangle

{{else}}

{{#compare line_items[*].sku "==" "VW-HTO-NV-HTO Box"}}

VW-HTO-NV-HTO Box

{{else}}

{{#compare line_items[*].sku "==" "idkmysize-ringsizer"}}

idkmysize-ringsizer

{{else}}

{{/compare}}

{{/compare}}

{{/contains}}

{{/contains}}

{{/contains}}

{{/contains}}

{{/if}}

Normally with [*], it should Start from 0

1- Working

The Handlebar Working when there are More than 2 items

2- Not Working

The Handlebar is not working because we have 2 items

ERROR :

Unable to create the order in NetSuite for the Shopify order #4290262302808 Could not compile handle bar "{{#if line_items.2.sku}}{{line_items.2.sku}}{{else}}{{#contains line_items.2.title "Gift Card"}}Gift Card{{else}}{{#contains line_items.2.name "Gift Wrap"}}Gift Wrapping{{else}}{{#contains line_items.2.name "Custom Engraving"}}Custom Engraving{{else}}{{#contains line_items.2.name "Custom Stone Count"}}Inlay Birthstone Bangle{{else}}{{#compare line_items.2.sku "==" "VW-HTO-NV-HTO Box"}}VW-...

as you can see we have just 2 items in JSON, it should start from [0]-[1] but for some reason keep going like [1]-[2] typically [2] is not exist it gives IndexOf error

Hello @bonniezacharia

This is Khaisar from Celigo. Please allow me to answer your query.
On high level the handlebar looks correct. But, when we are importing an Order, we write few substitute lines like Discount lines, Shipping line etc., This additional lines are based on the advanced settings you have selected. We need to also include those validations into the handlebar.

In this case where you are getting the error, can you please confirm if there is any line discount applied or Shipping cost added on the order and your advanced setting is set to add additional lines. Can you please confirm this.

Meanwhile I will also look into how we can tweak the handlebar you provided, so that it can also satisfy these additional line scenarios