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

Currency Symbol Change


Hamps

Question

Site URL: https://www.hampseshop.com/

Hi, I'm from Maldives, and I understand that squarespace does not have our currency supported yet. However, I have changed the currency symbol using a css code. But the problem is when ever I change a variant of a product like color, currency symbol chances back to default. Can someone help me out.

.sqs-money-native:before {
   content:'₦ '!important;
 }

 

Link to post
  • Answers 11
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

Popular Posts

@Hamps Another alternative solution is to leverage the MutationObserver Web API which listens for changes to that .product-list element and replaces the $ with MVR whenever it detects that something h

11 answers to this question

Recommended Posts

  • 0

Add to Home > Settings > Advanced > Code Injection > Footer

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
  window.Squarespace.onInitialize(Y, function(){  
		$(".ProductItem-details .product-price").html(function() { 
          return $(this).html().replace("$", "MRF");  
    });
	});
</script>

 

You can send your question to my email to get faster answer. / How to Setup Password & Share URL 

-- I'm Tuan, work for a non-profit project (build free libraries). I check the forum once or twice a day to help out the community. If you don't see me answering your question, you can send it to the email above. 

Link to post
  • 0

Thank you for responding,

I have removed the old code and did what you have adviced, but it's not working.

Am I doing it wrong?

Link to post
  • 0

I'm attaching a video with this code in the work

.sqs-money-native:before {
   content:'MRF '!important;
 }

this code is injected in design > custom css, it doesn't work when I inject it to Home > Settings > Advanced > Code Injection > Footer.

The code that you have doesn't work in either one, also I have tried with both codes.

Link to post
  • 0

above code solve this

 But the problem is when ever I change a variant of a product like color, currency symbol chances back to default

You can send your question to my email to get faster answer. / How to Setup Password & Share URL 

-- I'm Tuan, work for a non-profit project (build free libraries). I check the forum once or twice a day to help out the community. If you don't see me answering your question, you can send it to the email above. 

Link to post
  • 0

Add to Home > Settings > Advanced > Code Injection > Footer

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
  window.Squarespace.onInitialize(Y, function(){  
		$(".ProductItem-details .product-price").html(function() { 
          return $(this).html().replace("$", "MRF");  
    });
	});
</script>

I have tried this one but this doesn't work for me, what am I doing wrong?

I have also tried with and without the code I posted earlier and doesn't wrong either.

 

.sqs-money-native:before {
   content:'MRF '!important;
 }

Appreciate you responding so quickly.

Thank you

Link to post
  • 0
Posted (edited)

@Hamps Another alternative solution is to leverage the MutationObserver Web API which listens for changes to that .product-list element and replaces the $ with MVR whenever it detects that something has changed with that element:

(function () {

  // Select the node that will be observed for mutations
  var productSummaryPrice = document.querySelector('.ProductItem-summary .product-price');

  // Exit if target node isn't found.
  if(!productSummaryPrice) return;

  // Options for the observer (which mutations to observe)
  var config = { childList: true };

  // Create an observer instance linked to the callback function
  var observer = new MutationObserver(function () {
    var text = productSummaryPrice.textContent;
    productSummaryPrice.textContent = text.replace('$', 'MVR ');
  });

  // Start observing the target node for configured mutations
  observer.observe(productSummaryPrice, config);

})();

Make sure the code above is between <script> tags, example:

<script>
  // Add JS code here
</script>

 

Edited by jpeter
Link to post
  • 0

Jpeter

thank you for the response, this is very new to me. Could you please let me know a step by step guide.

Thank You again

 

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...