Product Enquiry form for Variable WooCommerce Products - https://www.damiencarbery.com/2018/04/product-enquiry-form-for-variable-woocommerce-products/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Ninja Forms - Set options in select field. | |
Plugin URI: https://www.damiencarbery.com/2018/04/product-enquiry-form-for-variable-woocommerce-products/ | |
Description: Set the options in a specific select field in Ninja Forms. | |
Author: Damien Carbery | |
Version: 0.1 | |
*/ | |
add_filter( 'ninja_forms_render_options', function($options,$settings){ | |
if ( 'select_product_attributes' == $settings[ 'key' ] ) { | |
$options = array(); | |
$options[] = array( | |
'label' => "A label", | |
'value' => 'a' | |
); | |
$options[] = array( | |
'label' => "B label", | |
'value' => 'b' | |
); | |
$options[] = array( | |
'label' => "C label", | |
'value' => 'c' | |
); | |
} | |
return $options; | |
},10,2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment