Hi,
I hope you are doing well.
You should try this
I am assuming name and product.name is your collection template.
If it still not work, Please provide store url (password as well if password protected) so that we can check issue on our side.
Thanks!
Please like and accept the solution if it is working correctly to you so that others can also get benefit from the same if they are searching for same or similar thing
Thanks!