"You must be logged in to checkout" is probably the only message in WooCommerce that doesn’t have any unique class and because of that I can’t change its background color using class="woocommerce"
or any other classes.
<div class="post-content clearfix">
<header class="entry-header">
<h1 class="page-title">Checkout</h1>
</header><!-- .entry-header -->
<div class="entry-content clearfix">
<div class="woocommerce">
<div class="woocommerce-notices-wrapper"></div>
<div class="woocommerce-notices-wrapper"></div>
You must be logged in to checkout.</div>
</div><!-- .entry-content -->
</div>
Is there any CSS solution for this? if this can only be done through a hook or filter is it possible to wrap it only with a class and get the translation directly from the source? I don’t want a custom translation for it.
2
Answers
The code shared by mujuonly works fine but if they change the source translation text for any reason, the text of the function also needs to be manually updated. so as I said all I wanted was to call the "You must be logged in" function directly instead of its translation text. I somehow figured this out by comparing mujuonly's code with another similar hook.
So here is the filter that I found for changing the text:
And here is how I wrapped it in a class:
Please go ahead and edit the hook if this is not the right way to do it. I'm not a coder though.
Add a specific ID and wrap it in a
<p>
tag using the above hook. Now you can add a specific style.You can inline CSS using the below hook.