Create "_price" in database

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Viewing 4 reply threads
  • Author
    • #118219

      Hi! I created this function to generate a new position in the database with metakey: “_price” because when i create a new product from frontend this is empty. The code works only when I update the post, not when I create it for the first time the product.
      And how i can traslate the calendar?
      Can you help me? Thank you !!

        function wpufe_update_post_price( $post_id ) {
          if ( 'product' != $_POST['post_type'] )
          $regular_price = get_post_meta( $post_id, '_regular_price', true );
          $sale_price = get_post_meta( $post_id, '_price', true );
          update_post_meta( $post_id, '_price', $regular_price );
          if ( !empty( $sale_price ) ) {
              update_post_meta( $post_id, '_price', $sale_price );
       add_action('save_post_product', 'wpufe_update_post_price', 10, 1);
        add_action('wp_insert_post', 'wpufe_update_post_price', 10, 1);
    • #118344


      Please use this action to save any custom meta from front-end dashboard.
      do_action( 'after_wcfm_products_manage_meta_save', $new_product_id, $wcfm_products_manage_form_data );


    • #118453

      Great! this code didnt work to me, something is wrong? Can you help me please?

      _price is the meta_key of woocommerce.

      add_filter( 'wcfm_form_custom_validation', function( $wcfm_products_manage_form_data, $form ) {
        if( $form_manager == 'product_manage' ) {
      			$regular_price = isset( $wcfm_products_manage_form_data['regular_price'] ) ? wc_clean( $wcfm_products_manage_form_data['regular_price'] ) : '';
      	update_post_meta( $new_product_id, '_price', $regular_price );
      	return $wcfm_products_manage_form_data;
      50, 2);
    • #118479


      Can you please explain us what exactly are you looking for?

      Regarding new meta save at the time of product creation/update,

      add_action( 'after_wcfm_products_manage_meta_save', 'fn_custom_product_meta_save',10,2 );
      function fn_custom_product_meta_save($new_product_id, $wcfm_products_manage_form_data) {
      	$regular_price = get_post_meta( $new_product_id, '_regular_price', true );  
        update_post_meta( $new_product_id, 'your_new_meta', $regular_price );  

      Now for using “wcfm_form_custom_validation” this filter what you want to do?


    • #118492

      thanks very much! it help me!

Viewing 4 reply threads
  • You must be logged in to reply to this topic.