php - Gravity Forms Dynamic Population Woocommerce -
i using gravity forms on wordpress woocommerce product page allowing customers customize products, , pull data external database populate fields on form. dropdown populates these 2 options show in sample code, issue pricing not working @ all. shows dropdown options no pricing.
the documentation on website shows array has price field: https://www.gravityhelp.com/documentation/article/dynamically-populating-drop-down-fields/
any or insight on appreciated!
code testing:
add_filter('gform_pre_render_1', 'populate_posts'); function populate_posts($form){ foreach($form['fields'] &$field){ if($field['type'] != 'select' || strpos($field['cssclass'], 'populate-posts') === false) continue; $choices = array(array('text' => 'test1', 'value' => 'test1','price'=>'0.00')); $choices[] = array('text' => 'test2', 'value' => 'test2','price'=>'17.38'); $field['choices'] = $choices; } return $form; }
Comments
Post a Comment