I’m working on a project where I need to link WooCommerce purchases with existing Gravity Forms submissions. Here’s what I’m trying to accomplish:
When someone (let’s call them Person X) fills out my form, their data gets saved as usual. Then another user (Person Y) can browse through all these submissions using GravityView’s search functionality. After Person Y finds a specific entry they’re interested in, they need to buy a related item through my WooCommerce store.
The tricky part is that once Person Y completes their purchase, I want those order details to be automatically added to Person X’s original form entry. Basically, I need to update the existing Gravity Forms entry with the new WooCommerce order information.
I’ve been looking for solutions but haven’t found anything that works yet. Has anyone implemented something similar? What’s the best approach to connect these two systems together?
I built something like this last year and hit a bunch of roadblocks. The main problem is keeping track of which form entry connects to which purchase. Here’s what actually worked: I added a custom field to WooCommerce products that saves the Gravity Forms entry ID. Then I used URL parameters when linking from GravityView to the product page. After someone completes their purchase, I used gform_post_update_entry with wp_insert_post to create a custom post type that tracks everything. You’ll need to think about what happens when multiple people try buying the same entry or payments fail. The trickiest part was dealing with abandoned carts and people who complete purchases in different sessions.
u should try using the woocommerce_order_status_completed hook to trigger your code when an order is done. after that, GFAPI::update_entry() can help u update the gravity form entry with the order info. just save the entry ID somewhere to connect them.