I am trying to change the height size of the ‘Add Note" input box in WooCommerce admin edit orders page
- screenshot below:
I constantly have to resize this box and I would like the height to be approx 200 px instead of 50.
The element is
textarea#add_order_note.input-text
.add_note #add_order_note {
width: 100%;
height: 50px;
}
I am hoping someone might be able to advise the correct CSS code I need to enter via Appearance – Customize – Additional CSS or perhaps I should be using a code snippet ?
I have made a few different CSS attempts, but I don’t know how to input the code correctly
4
Answers
I found a solution.
Add this to your functions theme.
Add the below code snippet to your active theme
functions.php
Tested OK with WooCommerce 6.3. Adding the style override to an existing style sheet can be done using the WP standard function wp_add_inline_style()
admin_enqueue_scripts
is the proper hook to use when enqueuing scripts and styles that are meant to be used in the administration panel. Despite the name, it is used for enqueuing both scripts and styles.In css:
Seeing as this is a change you want to persist through plugin updates, theme updates, etc. It should be made within the CSS file of your child theme. If you’re unsure what I mean by that, I highly recommend you read up on using a child theme before any continued development. There is a tutorial from Woocommerce about this as well, besides those found on WordPress.org.
Another alternative is a plugin designed for CSS alteration, i.e. Jetpack, as mentioned in the Woocommerce Best Practices Documentation.
While there are many ways to accomplish this, adding a snippet into your
functions.php
isn’t ideal from a design and maintainability perspective. That should be reserved for logical (functional, business logic, whatever term you choose) changes, rather than layout (view, display, etc) changes. WordPress is built on the principles of MVC and it’s best to maintain that logical separation of code whenever possible. Even in "Appearance – Customize – Additional CSS" is better than infunctions.php
– although I prefer to avoid using that altogether, as it can quickly become cluttered and difficult to maintain.