File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * Gravity Shop // Product Configurator // Capture Variation in Field
3+ * https://gravitywiz.com/documentation/gravity-shop-product-configurator/
4+ *
5+ * Capture the selected variation in a form field.
6+ *
7+ * Instructions:
8+ *
9+ * 1. Install this snippet with our free Custom JavaScript plugin.
10+ * https://gravitywiz.com/gravity-forms-custom-javascript/
11+ *
12+ * 2. Follow the inline instructions to update the snippet for your form.
13+ */
14+ // Update "pa_color" to the variation attribute you would like to capture.
15+ var $variation = $ ( '#pa_color' ) ;
16+
17+ // Update "6" to the ID of the field on your form that will captured the selected variation attribute.
18+ var $targetField = $ ( '#input_GFFORMID_6' ) ;
19+
20+ $variation . on ( 'change' , function ( ) {
21+ $targetField . val ( $variation . val ( ) ) ;
22+ } ) ;
23+
24+ $targetField . val ( $variation . val ( ) ) ;
You can’t perform that action at this time.
0 commit comments