Editing Woocommerce pages

Spock

Free Member
Apr 24, 2008
1,219
207
Worcester
Hi folks

So I'm nearly there with a new store but would like to change a few default words that Woo uses on the pages. I have looked but can't find the specific pages I need to edit them on though! Specifically...

1. Change 'brand' on product page to a different word
2. Change 'search for products' text in search field
3. Change 'Related products'

I would also like to edit the template for the brand pages.

Thanks
 

fisicx

Moderator
Sep 12, 2006
46,913
8
15,502
Aldershot
www.aerin.co.uk
Upvote 0

Raw Rob

Free Member
Aug 1, 2009
1,129
236
London/Portugal
The other way to attack this problem is by using an IDE or editor that will search multiple files at the same time, then just search for the text you want to change in the appropriate folders. (I use Dreamweaver, one of the few things I still use it for, Notepad++ also has this function, I'm sure many other programs do too.)
 
Upvote 0
For such questions my first 'go to' source is Business Bloomer and he might have the answer you are looking for!

https://businessbloomer.com/woocommerce-add-custom-search-bar-headerfooter/

In particular, this snippet he uses:

// ----------------------------------
// 3. CHANGE PLACEHOLDER & BUTTON TEXT

function storefront_search_form_modify( $html ) {
return str_replace( array('Search …','Search'), array('WooCommerce Hooks, Storefront Theme, Google AdWords...','Search Article'), $html );
}

add_filter( 'get_search_form', 'storefront_search_form_modify' );


// ------------------------------
 
Upvote 0

fisicx

Moderator
Sep 12, 2006
46,913
8
15,502
Aldershot
www.aerin.co.uk
You can do this by modifying the languages file or by adding some code in the functions.php file.
That's not really going to help, they want to edit the brand pages.
 
Upvote 0
That's not really going to help, they want to edit the brand pages.

If you want to modify any of the language or terms being used in Woo, you can do so by using the method I mentioned. I've done countless WooCommerce projects and that's how I've done it. Unless it's "editable content" which you can easily change within the theme or Woo settings, using the functions.php file is the best way.
 
Upvote 0

fisicx

Moderator
Sep 12, 2006
46,913
8
15,502
Aldershot
www.aerin.co.uk
But if you want to change a template it's better to edit the template than try to do it all through functions.php.

It's not even clear from the opening post if they are using a woo theme or a standard theme with just woo-commerce.
 
Upvote 0

Spock

Free Member
Apr 24, 2008
1,219
207
Worcester
Hi, I'm using Woodmart which isn't a woo theme but as a store theme it is ready for woo.

I searched through many files looking for certain text but failed to find any. I thought it would be a lot easier! I have a child theme setup and running and using the excellent Booster for Woocommerce plugin it allows you to edit template files. I just need to know which ones!
 
Upvote 0

antropy

Business Member
  • Business Listing
    Aug 2, 2010
    5,324
    1,104
    West Sussex, UK
    www.antropy.co.uk
    The other way to attack this problem is by using an IDE or editor that will search multiple files at the same time, then just search for the text you want to change in the appropriate folders.
    Yeah this is a method I use a lot when coding. Shout out to someone who still uses Dreamweaver, I'd say that was my first proper IDE, fond memories!

    I searched through many files looking for certain text but failed to find any.
    How did you search?

    If you have ssh access to the server it's on, try grep:

    grep -ril "your word"
    Paul
     
    Upvote 0

    antropy

    Business Member
  • Business Listing
    Aug 2, 2010
    5,324
    1,104
    West Sussex, UK
    www.antropy.co.uk
    I was opening individual files and doing a search
    1d7bh7.jpg


    Had a look at ssh and got scared!
    Maybe pay a developer to fix then?

    Paul
     
    Upvote 0
    woocommerce content can be changed using a combination of hooks, filters and template files. Depending on what you want to change will determine the best methodology.

    for example related products display can be over-ridden by creating your own related products template file and including that in your theme.

    The standard method for over-riding woocommerce templates is to create a folder call "woocommerce" in your theme folder. locate the template you want to over ride in the woocommerce templates folder of the plugin and emulate this structure in your woocommerce theme folder. Best to start by simply copying the template file over and work from there.

    Woocommerce templates are also filled with action hooks so it is also possible to add or change content using these:

    remove_action('action-hook-name', 'function-name')
    add_action('action-hook-name', 'function-name', order/priority)

    @Iain_Henderson has already given an example of the use of filters

    With respect to "Brand", if this is a product category you have created then you can produce a custom archive page for this. e.g. taxonomy-product_cat-brand.php

    alternatively, use conditional statements in a custom archive page to alter presentation based on which category you are in.
     
    • Like
    Reactions: Spock
    Upvote 0

    Latest Articles

    Join UK Business Forums for free business advice