title: Enable Wholesale prices in Woocommerce 3
body: <p>In wooCommerce, I have added a custom meta field with a custom price (wholesale price) in edit product pages settings. Everything works well. </p>
  
  <p>When I set a wholesale price it works fine everywhere. But if I try to change this wholesale price it doesn't work. the old price remains everywhere. </p>
  
  <p>What I am doing wrong? How can I solve this problem to allow wholesale price changes?</p>
  
  <p>The code I am using:</p>
  
  <pre><code>function w4dev_get_wholesale_price( $product )
  {
      if( 
          $product-&gt;is_type( array('simple', 'variable') ) 
          &amp;&amp; get_post_meta( $product-&gt;id, '_wholesale_price', true ) &gt; 0 
      ){
          return get_post_meta( $product-&gt;id, '_wholesale_price', true );
      }
      elseif( 
          $product-&gt;is_type('variation') 
          &amp;&amp; get_post_meta( $product-&gt;variation_id, '_wholesale_price', true ) &gt; 0 
      ){
          return get_post_meta( $product-&gt;variation_id, '_wholesale_price', true );
      }
      return 0;
  }
  
  add_action( 'woocommerce_product_options_pricing', 'w4dev_woocommerce_product_options_pricing' );
  function w4dev_woocommerce_product_options_pricing()
  {
      woocommerce_wp_text_input( array( 
          'id' =&gt; '_wholesale_price',
          'class' =&gt; 'wc_input_wholesale_price short',
          'label' =&gt; __( 'Wholesale Price', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol().')',
          'type' =&gt; 'text'
      ));
  }
  
  add_action( 'woocommerce_process_product_meta_simple', 'w4dev_woocommerce_process_product_meta_simple', 10, 1 );
  function w4dev_woocommerce_process_product_meta_simple( $product_id )
  {
      if( isset($_POST['_wholesale_price']) &amp;&amp; $_POST['_wholesale_price'] &gt; 0 ){
          update_post_meta( $product_id, '_wholesale_price', $_POST['_wholesale_price'] );
          }
  }
  
  add_filter( 'woocommerce_get_price', 'w4dev_woocommerce_get_price', 10, 2);
  function w4dev_woocommerce_get_price( $price, $product )
  {
      if(  w4dev_get_wholesale_price($product) &gt; 0 ) {
          $price = w4dev_get_wholesale_price($product);
      return $price;
      }
  }
  </code></pre>