• Resolved alexandraqb

    (@alexandraqb)


    Hello,

    I have been searching for the best part of the day looking for what I feel should be something very easy to change.

    Is it possible to change the button text within the sitewide store notice from ‘DISMISS’ to ‘OK’.

    Any kind of snippet I can use please?, as I really don’t want to install anymore plug-ins.

    Thank you for your time,

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thomas Shellberg

    (@shellbeezy)

    Automattic Happiness Engineer

    @alexandraqb – you should be able to change this using localization, either using PoEdit or Loco Translate. You essentially “Translate” one string of text(“Dismiss”) into another(“OK”).

    https://docs.woocommerce.com/document/woocommerce-localization/#section-5

    Thread Starter alexandraqb

    (@alexandraqb)

    Hi,

    Thank you for your reply,
    If I have understood that correctly, that will change the word ‘Dismiss’ to ‘ok’ site wide.

    I only wish to edit the button text within the ‘store notice’.
    At the bottom of my website I have a pop up store notice, to close this people have to click the word ‘DISMISS’ I would like the link to read ‘OK’

    I’m sorry if I have not made myself clear, I’m unsure what some of the technical terms are called.

    Thread Starter alexandraqb

    (@alexandraqb)

    I have used Google tools to locate the link, and I would like to change this:

    <a href="#" class="woocommerce-store-notice__dismiss-link">Dismiss</a>

    However I have no idea, where I can find this within my website codes to edit.

    Any help would be appreciated,

    Thank you

    • This reply was modified 6 years, 9 months ago by alexandraqb.
    Thread Starter alexandraqb

    (@alexandraqb)

    <a href="#" class="woocommerce-store-notice__dismiss-link">Dismiss</a>

    jessepearson

    (@jessepearson)

    Automattic Happiness Engineer

    @alexandraqb If this notice is what you were wanting to change, the below code will do it.


    Link to image: https://cld.wthms.co/L0YcKE

    function jp_replace_dismiss( $notice ){
    	return str_replace( 'Dismiss', 'OK', $notice );
    }
    add_filter( 'woocommerce_demo_store','jp_replace_dismiss' );

    This will either need to be added to your functions.php file, or through a code snippets plugin. Rather than replacing all instances of “Dismiss”, it looks for it in that one instance and replaces it as it’s being output.

    Thread Starter alexandraqb

    (@alexandraqb)

    Yay, thank you so much.

    That’s exactly what I was hoping to change, Thank you again for your help.

    I just have one more question, even when the link is clicked, when loading another website page, the store notice message is seen briefly before disappearing.

    Is there anyway to stop this from happening?
    I’m unsure if this is caused by my browser & phone, or if it’s a well known problem.

    I’m hoping to use the store notice, as a pop-up for accepting cookies, naturally when clicked it does not need to be seen again.

    jessepearson

    (@jessepearson)

    Automattic Happiness Engineer

    @alexandraqb It flashes because as long as the notice is turned on it is always there. If the Dismiss link has been clicked, it is then hidden by JavaScript. Since JavaScript doesn’t execute until the page is fully loaded, the notice is seen until the JS executes when the page finishes loading.

    Thread Starter alexandraqb

    (@alexandraqb)

    Hello,

    Thank you for explaining that to me, I fully understand,

    Thank you once again for all your help and information.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Store Notice: Edit the word “DISMISS” to “OK”’ is closed to new replies.