0

I added a new number field in store-manager WCFM in the product manager, and now I want to save the value of that field and for that I used the function save_add_product_meta, but it doesn't work... please if somebody can help me with that I will be so greatful

add_action ( 'after_wcfm_products_manage_pricing_fields' ,'add_new_field' ),20 );. function add_new_field(){

                  global $WCFM  ;
                $WCFM->wcfm_fields->wcfm_generate_form_field( array("minimumOrderQuantityFM" => array(
                        'label' => __( 'Minimum order quantity', 'wc-frontend-manager') , 
                        'name' => 'minimumOrderQuantity', 
                        'type' => 'number', 
                        'class' => 'wcfm-text wcfm_ele simple variable external grouped booking', 
                        'label_class' => 'wcfm_title', 
                     ) ));

add_action ( 'after_wcfm_products_manage_meta_save' ,'save_add_product_meta',10,2 ) ; function save_add_product_meta($post_id, $wcfm_products_manage_form_data ){

        $wcfm_moq =! empty( $wcfm_products_manage_form_data['minimumOrderQuantityFM'] ) ? 'yes' : 'no';
        update_post_meta($post_id, 'minimumOrderQuantityFM', $wcfm_moq  );
    
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.