Skip to content

Commit ffcc2d5

Browse files
authored
gspc-capture-variation-in-field.js: Added a new snippet.
1 parent 6a25f15 commit ffcc2d5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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() );

0 commit comments

Comments
 (0)