Autofill Form from Cookies

If your custom code is not working, I recommend using the built in logging in Gravity Forms to see what’s going wrong. First please enable logging:

Next, add some custom logging statements to your code. I recommend adding a logging statement inside each loop or conditional, and also after you set any variable or object, to see if it holds the value you think it should. Here is how you can add custom logging to your code, which will be added to the Gravity Forms logs:

With that additional logging, you should be able to see where this is falling apart.