Home > Software design >  Replacing the text by using jQuery script in shopify platform on the product page
Replacing the text by using jQuery script in shopify platform on the product page

Time:10-29

Please help me out I'm a beginner in the Shopify platform and don't understand how to add my script to Shopify files. Please help me with where and in which file should I place the code to replace the text on the product page. I need to change the Price text with M.R.P see the screenshot for reference: https://prnt.sc/xFWR-QIpVkPr

Here is the product page URL: https://uniqaya.com/products/exfoliating-body-scrub-polisher-with-coffee-grape-seed-oil?_pos=4&_sid=322f78f1b&_ss=r

See the code that I have used for scripting to replace, the HTML below is from the product page. I'm a little confused that the js library functions $ and jQuery both don't work in Shopify. Please help and give me the best solution to do this.

$(document).ready(function() {
    $('.product-block product-block--price .variant__label').text('M.R.P');
});
<div data-product-blocks="">
    <div >
        <label  for="ProductPrice-template--15540147159204__main">
            Price
        </label>
    </div>
</div>

the text with mine.

CodePudding user response:

$(document).ready(function() {
    $('.product-block--price label').text('M.R.P');
});

With js

document.querySelector('.product-block--price label').innerHTML = "M.R.P"
  • Related