Replace hardcoded store ID = 1 with either input argument or detected default store ID.

Can you add the SKU filter to the exception.  "No products match the SKU filter: $productInput"