Hello, welcome to therichpost.com. In this post, I will tell you WOOCOMMERCE: ADD WHOLESALE PRICE IN ADMIN PRODUCT PAGE. WordPress is the best cms and Woocommerce is the best Ecommerce plugin. WordPress hooks(add_action, add_filter) give us the power to edit or change the code without interruption into the files and this is the best thing about wordpress. Now I am going to tell you how the hooks work.
Image of Wholesale Price:

Here is the working code for WOOCOMMERCE: ADD WHOLESALE PRICE IN ADMIN PRODUCT PAGE and you need to add this code into your theme’s functions.php file:
// CHANGE SALE PRICE LABEL TO SELLING PRICE & CHANGE REGULAR PRICE LABEL TO RRP
add_action(‘woocommerce_product_options_general_product_data’, ‘woo_add_custom_general_fields’);
add_action(‘woocommerce_process_product_meta’, ‘woo_add_custom_general_fields_save’);
function woo_add_custom_general_fields()
{
global $woocommerce, $post;
echo ‘<div class=”options_group”>’;
woocommerce_wp_text_input(array(
‘id’ => ‘_wholesale_price_field’,
‘label’ => __(‘Wholesale Price($)’, ‘woocommerce’) ,
‘placeholder’ => ”,
‘description’ => __(‘Enter the wholesale price here.’, ‘woocommerce’) ,
‘type’ => ‘number’,
‘custom_attributes’ => array(
‘step’ => ‘any’,
‘min’ => ‘0’
)
));
echo ‘</div>’;
}
function woo_add_custom_general_fields_save($post_id)
{
$woocommerce_number_field = $_POST[‘_wholesale_price_field’];
if (!empty($woocommerce_number_field)) update_post_meta($post_id, ‘_wholesale_price_field’, esc_attr($woocommerce_number_field));
}
There are so many hooks in woocommerce and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

Leave a Reply
You must be logged in to post a comment.