woocommerceHow to add download pdf link in woocommerce single product page?

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:

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

By therichpost

Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 19, MedusaJs, Next.js, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

One thought on “WOOCOMMERCE: ADD WHOLESALE PRICE IN ADMIN PRODUCT PAGE”
  1. public function checkemail(Request $req)
    {
    $email = $req->email;
    $emailcheck = $this->PDO->prepare(“SELECT * FROM user WHERE email = ?”);
    $emailcheck->execute([$email]);
    $emailcheck = $emailcheck->fetchAll(\PDO::FETCH_OBJ);
    if(count($emailcheck)>0)
    {
    echo “Email Already In Use.”;
    }
    }

    Route::post(‘/checkemail’, ‘CalendarController@checkemail’)->middleware(‘ajax’);
    /*Email Already In Use*/
    function checkmain(email)
    {
    $.ajax({
    url: Laravel.appUrl+’/calendar/checkemail’,
    type: ‘POST’,
    data: { email: email },
    }).done(function(response) {
    if(response == “Email Already In Use.”)
    {
    $(“#cemail”).css(“border”, “1px solid red”);
    $(“#cemailcheck”).show();
    $(“#cemail”).attr(“placeholder”, $(“#cemail”).val());
    $(“#cemail”).val(“”);

    }
    else
    {
    $(“#cemail”).css(“border”, “1px solid rgba(0, 0, 0, 0.15)”);
    $(“#cemailcheck”).hide();
    }

    });
    }
    /*Email Already In Use*/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.