If you're triggering products in custom code, you'll want to also make sure it's being included in linkTrackVars. Pretty sure it's by design, it's just less than ideal because there isn't an easy way to populate the products variable without custom code.
I'm completely new to Adobe. I come from a GA & GTM background. The custom code that you've written in set variables, is it mandatory for each and every step in the funnel? Like scView, scAdd, scCheckout Etc? I've configured the entire funnel from product view to confirmation page but when I check in AA reports I can see 'undefined' values for most of the product categories and ID's.