{"id":627,"date":"2023-09-07T08:26:25","date_gmt":"2023-09-07T08:26:25","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2023\/09\/07\/8343753-hostinger-website-builder-how-to-change-the-price-format-in-the-online-store\/"},"modified":"2026-03-16T12:12:02","modified_gmt":"2026-03-16T12:12:02","slug":"8343753-hostinger-website-builder-how-to-change-the-price-format-in-the-online-store","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/8343753-hostinger-website-builder-how-to-change-the-price-format-in-the-online-store\/","title":{"rendered":"Hostinger Website Builder: How to Change the Price Format in the Online Store"},"content":{"rendered":"<p class=\"no-margin\">This article explains how to <b>change the format of product prices<\/b> in the online store created with <b>Hostinger Website Builder<\/b>.<\/p><div class=\"intercom-interblocks-callout\" style=\"background-color: #e3e7fa80;border-color: #334bfa33\">\n<p class=\"no-margin\">The changes will be visible in <b>product list sections<\/b>, on<b> product pages<\/b>, and in the <b>shopping bag<\/b>. The default prices will still be shown in the checkout, invoices, and store management area &#128161; <\/p>\n<\/div><p class=\"no-margin\">\n<\/p><h2 id=\"h_6bba690b13\">Copy the Code<\/h2><pre><code>&lt;script&gt;<br>  const currency = \"&euro;\";<br>  const thousandsSeparator = \".\";<br>  const removeCents = false;<br>  const priceInTheEnd = false;<br>  let fullPrice;<br><br>  const addCommaToPrice = (price, currency) =&gt; {<br>    \/* currency at the end *\/<br>    if (price.innerText.slice(0, currency.length) !== currency) {<br>      fullPrice = price.innerText.substring(<br>        0,<br>        price.innerText.indexOf(currency)<br>      );<br>    } else {<br>      \/* currency in front *\/<br>      fullPrice = price.innerText.slice(currency.length);<br>    }<br><br>    \/* if cents exist *\/<br>    if (removeCents) {<br>      fullPrice = fullPrice.slice(0, -3);<br>    }<br>    fullPrice = fullPrice<br>      .toString()<br>      .replace(\/B(?=(d{3})+(?!d))\/g, thousandsSeparator);<br><br>    if (priceInTheEnd) {<br>      fullPrice = `${fullPrice} ${currency}n`;<br>    } else {<br>      fullPrice = `${currency} ${fullPrice}n`;<br>    }<br><br>    price.innerText = fullPrice;<br>  };<br><br>  const priceChanged = (price) =&gt; {<br>    if (price.innerHTML.indexOf(\"&lt;br&gt;\") &gt; -1) {<br>      return true;<br>    } else {<br>      return false;<br>    }<br>  };<br><br>  setInterval(() =&gt; {<br>    \/*Product pages*\/<br>    if (<br>      document.querySelector(\".block-product__price\") &amp;&amp;<br>      !priceChanged(document.querySelector(\".block-product__price\"))<br>    ) {<br>      document.querySelectorAll(\".block-product__price\").forEach((price) =&gt; {<br>        addCommaToPrice(price, currency);<br>      });<br>    }<br><br>    \/*Cart*\/<br>    if (<br>      document.querySelector(\".cart__price\") &amp;&amp;<br>      !priceChanged(document.querySelector(\".cart__price\"))<br>    ) {<br>      document.querySelectorAll(\"li.cart__list-item\").forEach((product) =&gt; {<br>        if (product.contains(product.querySelector(\".cart__sale-price\"))) {<br>          addCommaToPrice(product.querySelector(\".cart__price\"), currency);<br>          addCommaToPrice(product.querySelector(\".cart__sale-price\"), currency);<br>        } else {<br>          addCommaToPrice(product.querySelector(\".cart__price\"), currency);<br>        }<br>      });<br><br>      if (!priceChanged(document.querySelector(\".cart__title span\"))) {<br>        addCommaToPrice(document.querySelector(\".cart__title span\"), currency);<br>      }<br>    }<br><br>    const priceSelector =<br>      \".product-list-item__price-wrapper span:not(.product-list-item__price-range)\";<br><br>    \/*Section*\/<br>    if (<br>      document.querySelector(priceSelector) &amp;&amp;<br>      !priceChanged(document.querySelector(priceSelector))<br>    ) {<br>      document.querySelectorAll(\".product-list-item\").forEach((product) =&gt; {<br>        if (product.querySelector(\"p.product-list-item__price-content\")) {<br>          addCommaToPrice(product.querySelector(priceSelector), currency);<br>          addCommaToPrice(<br>            product.querySelector(\"p.product-list-item__price-content\"),<br>            currency<br>          );<br>        } else {<br>          addCommaToPrice(product.querySelector(priceSelector), currency);<br>        }<br>      });<br>    }<br>  }, 500);<br>&lt;\/script&gt;<\/code><\/pre><p class=\"no-margin\">\n<\/p><h2 id=\"h_9a25e4088d\">Customize the Code<\/h2><p class=\"no-margin\">Make the preferred edits in the code depending on what you&rsquo;d like to change. For example, change the currency symbol. <\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_f22176e276\">Paste the Code<\/h2><p class=\"no-margin\">Within the builder, go to your website&rsquo;s <b>Settings<\/b> &rarr; <b>Integrations<\/b>, and paste the code in the <b><a href=\"\/support\/6445594-website-builder-how-to-add-custom-code-to-the-head-head-part-of-a-website-s-code\" target=\"_blank\" class=\"intercom-content-link\">Custom code<\/a><\/b> field. Then, <b>save the changes<\/b> and <b>update your website<\/b>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to change the format of product prices in your online store created with Hostinger AI Builder<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[286],"tags":[],"class_list":["post-627","post","type-post","status-publish","format-standard","hentry","category-online-store"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/8343753-hostinger-website-builder-how-to-change-the-price-format-in-the-online-store\/","default":1},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/support\/8343753-hostinger-creador-de-sitios-web-como-cambiar-el-formato-del-precio-en-la-tienda-online\/","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=627"}],"version-history":[{"count":0,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/627\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}