Support » Plugin: WooCommerce » Backend Customization

  • Hello!
    I’ve done a lot of research and found you can remove tabs and add fields. I was wondering if I could do more though. Using PHP in the functions.php file (or via another method) can I remove the “Simple product” drop down, Virtual and Downloadable checkboxes, rename “Sale price ($), and/or stop users from adding custom attributes (only use ones I define).

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,
    Of course, you can edit the page layout like you want.
    You can employ not only PHP but also CSS to hide or show some sections – that’s the best way to get what you require.
    Also, you can build a child theme to parent theme that is tailored as much as possible to your requirements.
    To rename the sale price or modify some parts of the admin area you have to alter get_price_html method which can be done by using the following hook for simple product: woocommerce_get_price_html.
    Code goes in function.php file of your active child theme (or theme). Or also in any plugin PHP files.

    More reference documentation about WooCommerce hooks you’ll find here: https://docs.woocommerce.com/document/introduction-to-hooks-actions-and-filters/

    Hope this helps!

    @motylanogha Could you give me an example on how I would change the name from say “Sale price ($)” to “Paid Price ($)”?

    @zenixnet
    Sure,
    You may add a function that swaps this particular text for a certain product like:
    This can be done using the built in WordPress add filter function. For example, if we had a product with an id of 55 and we wanted to change the text of the “Sale Price Text” field to “Your new Sale Price Text”, the function would like this:

    function change_before_sale_price( $woo_rrp_before_sale_price ) {
        global $post;
        if ( '55' == $post->ID ) :
            return 'Your new Sale Price Text';
        else :
            return $woo_rrp_before_sale_price;
        endif;
    }
    add_filter( 'woo_rrp_before_sale_price', 'change_before_sale_price' );

    Otherwise, you can use this plugin to modify it from admin panel eg: https://wordpress.org/plugins/woocommerce-rrp/

    I hope that will help you!

    @motylanogha Thank you for the code snippet, unfortunately that isn’t quite what I need. Here is an illustration of all the things I hope to do:

    Circled text I’d like to change, crossed out things I’d like to remove completely, and only able to use the predefined attributes.

    • This reply was modified 5 months, 1 week ago by  zenixnet.
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.