product_type_options get saved value [closed]

I have modified your code please check the below code. function add_octopus_child_option( $product_type_options ) { $product_type_options[‘childocto’] = array( ‘id’ => ‘_childocto’, ‘wrapper_class’ => ‘show_if_octopus’, ‘label’ => __( ‘Gekoppeld’, ‘woocommerce’ ), ‘description’ => __( ‘Vink dit aan indien dit niet het hoofdproduct is.’, ‘woocommerce’ ), ‘default’ => ‘no’ ); return $product_type_options; } add_filter( ‘product_type_options’, ‘add_octopus_child_option’ ); … Read more

Combine one action and one filter

the filter function must be inside the action function, because if it isnt it is not recognize. So I think. At least with variables is like this. add_action( ‘woocommerce_before_checkout_form’, ‘add_checkout_error’, 9 ); function add_checkout_error() { wc_print_notice( __( ‘An error message.’, ‘woocommerce’ ), ‘error’ ); add_filter(‘woocommerce_order_button_html’, ‘remove_order_button_html’ ); function remove_order_button_html( $button ) { $button = ”; … Read more

Call product search from custom hook

What I understood is that no AJAX is needed. If somebody don’t understand all the fancy example around, you just need to use the pre_get_posts hook. In my case what I did is: function custom_product_search($query) { $query->query_vars[‘post_parent’] = htmlentities($_GET[‘model’]) ?? htmlentities($_GET[‘make’]); return $query; } add_action(“pre_get_posts”, ‘custom_product_search’); I don’t know if this is the correct solution … Read more