Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Change text on product page pricing and "select" option


TomasAH

Question

Hi,On product pages where product has variants I want to change the text of 2 elements:1: There is a "from" before pricing which I would like to change.2: On these products there is a dropdown which has the text "select". Also would like to change this.

Anybody know if/how this can be done?

BR/Tomasalt text

productpage-1.png.d6bb6c48b75de1cc291840b4c00a05a7.png

productpage-2.png.3f9e686dc3bc95ff488fbf926224f06c.png

Edited by TomasAH
Initial Revision
Link to post
  • Answers 23
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

Popular Posts

Thanks @creedon ! It works perfectly.    

Posted Images

23 answers to this question

Recommended Posts

  • 0
6 hours ago, Matgal said:

Hei TomasAH, Fant du svaret på dette?

 

I solved some cases. If you share link to product page, I can take a look

Link to post
  • 0

 

On 3/29/2020 at 1:50 AM, tuanphan said:

I solved some cases. If you share link to product page, I can take a look

Thanks! Very nice of you, i really want to change "Login" "Select" and "from" and really all English word in checkout. 

https://www.matgal.no/nettbutikk

Edited by Matgal
missed word
Link to post
  • 0
On 1/16/2021 at 1:17 AM, DavidHortvik said:

Hi all, has this been resolved? I am looking for exactly the same thing: change "Login" "Select" and "from" and really all English word in checkout. 

Can you share link to a product? We can help easier

Link to post
  • 0

Hi all,

 

I meet the exact problem. I want to translate a store from french to english.

I have 2 stores: one in french, and the second is in English.

For the english store, it is written in french "à partir de" and "sélectionnez".

How can I solve it ?

 

connectfootballparis.com/store-1

temporary password : azertyuiop

 

thanks
 

 

Link to post
  • 0
20 hours ago, Salem said:

Hi all,

 

I meet the exact problem. I want to translate a store from french to english.

I have 2 stores: one in french, and the second is in English.

For the english store, it is written in french "à partir de" and "sélectionnez".

How can I solve it ?

 

connectfootballparis.com/store-1

temporary password : azertyuiop

 

thanks
 

 

Hi. You want to translate 2 text: "à partir de" and "sélectionnez".?

Link to post
  • 0

@Salem

For the Sélectionnez replacement.

Add the following to Settings > Advanced > Code Injection > HEADER.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

Add the following to Store Settings > Advanced > Page Header Code Injection for the store page.

<script>

  $( ( ) => {
  
    /*
    
      replace variant menu "select" text
      
      SS Version : 7.1
      
      */
      
    const fromText = 'Sélectionnez';
    
    const toText = 'Select';
    
    // do not change anything below, there be the borg here
    
    if ( ! $( '.ProductItem' ).length ) return; // bail if not product detail
    
    if ( ! 'MutationObserver' in window ) return;
    
    // begin replace text
    
      $( '.variant-option' ).each ( function ( ) {
      
        const $this = $( this );
        
        let attribute = 'aria-label';
        
        let $e = $( '[data-variant-option-name]', $this );
        
        let s = $e
        
          .attr ( attribute )
          
          .replace ( fromText, toText );
          
        $e.attr ( attribute, s );
        
        $e = $( 'option:first', $this );
        
        s = $e
        
          .text ( )
          
          .replace ( fromText, toText );
          
        $e.text ( s );
        
        } );
        
      // end replace text
      
    const observer = new MutationObserver ( function ( mutations ) {
    
      $.each ( mutations, function ( ) {
      
        const attribute = 'data-text';
        
        if ( this.attributeName != attribute ) return;
        
        const $e = $( this.target );
        
        let s = $e.attr ( attribute );
        
        if ( ! s.includes ( fromText ) ) return;
        
        s = s.replace ( fromText, toText );
        
        $e.attr ( attribute, s );
        
        } );
        
      } );
      
    // start listening for changes in varient menu
    
    $( '.variant-select-wrapper' ).each ( function ( ) {
    
      observer.observe ( this, { attributes : true } );
      
      } );
      
    } );
    
  </script>

This is for v7.1.

For the à partir de a variation on the following solution should work. Instead of removing from I'd just change the text. I'll have to do this in just a bit here. Bump this message if I don't get back with some code in several days.

 

Let us know how it goes.

Edited by creedon
version 2

Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support!

Link to post
  • 0

Hi @creedon,

 

Thank you for your reply,


For 'A partir de', I managed to replace the text, thanks to your post.

 

And for 'Sélectionnez', you snippet didn't work, I tried to fix it but I couldn't... 😢 

The error appearing on console is :

jQuery.Deferred exception: undefined is not an object (evaluating '$e
        
          .attr ( attribute )
          
          .replace') (2)

 

I'm not expert on JQuery but I think the selector couldn't find the 'data-text' attribute...

 

 

thanks a lot for your help !

 

 

Link to post
  • 0
7 hours ago, Salem said:

And for 'Sélectionnez', you snippet didn't work, I tried to fix it but I couldn't... 😢 

I think I see what is happening. Apparently by the time my code runs SS it still filling in some of the data for the variant menus. Which obviously didn't come up in my initial testing! ☹️

I'll take another crack at it.

Edited by creedon

Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support!

Link to post
  • 0

@Fredlund

Please post the URL for a product with variants on your site.

If your site is not public please set up a site-wide password, if you've not already done so.

Post the password here.

Adding a site-wide password is not a security breach. Please read the documentation at the link provided to understand how it works.

I can then take a look at your issue.

Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support!

Link to post
  • 0
3 hours ago, creedon said:

@Fredlund

Please post the URL for a product with variants on your site.

Post the password here.

I can then take a look at your issue.

URL: https://buildwell.se/webshop

Password: lyft725

So it's both changing the word "From" as in "From 500.00 kr" on the product list page (webshop 1.png) and changing the word "Select" in the dropdown menu on a specific product (webshop 2.png). Bonus: Removing the ".00" on all the prices, we don't have prices that ever use them. It's just 500 kr or 350 kr, not 499.99 kr or such.

Thanks!

webshop 1.png

webshop 2.png

Link to post
  • 0
2 hours ago, Fredlund said:

Oh, and also these pop-ups: "Unable to add item: Please select the ... and ... option."

Please see the following.

Same caveat. This is not a language translator so I don't know if it will work for how your language strings lists together. You'll want to change append to false.

You might want to watch that thread as there is another piece of requested code that I've not done yet, that may be of use to you.

Let us know how it goes.

Edited by creedon

Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support!

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...