How do I write custom function to delete a sales order's line item if the line item meets a certain criteria?

How do I write custom function to delete a sales order's line item if the line item meets a certain criteria?

Hello, 

We recently started using an add-on app with our Shopify, called Bundleup. This app is a game changer for us.  It runs an unbundling feature that unbundles any bundled item on an order. The bundle item (which for us is a Kit) is removed from the order and the constituents of the bundle are added.  However, when the sales order is created in Zoho, the constituents AND the bundle item are on the order. 

I am not sure why the removed item shows up on the sales order.  I do not think it has to do with the timing of the sync that occurs.  

So, I would like to create a custom function that triggers upon the creation of a sales order.  Then, if any of the items on the order meet the criteria (Bundle Item) it gets removed from the sales order.  I need this to execute before our other custom function that invoices the sales order.  

Look forward to hearing a solution that will help us to resolve this issue. 

Thanks!
Amanda