Shopify themes, liquid, logos, and UX
Dear, Shopify support, partners, users, hope you are doing great!
I need assistance with making changes to my product pricing display on Shopify. Specifically, I want to remove 'Dhr.' from the pricing. Could you please guide me on how to do this?
And I found one option in currency related settings, here's the image:
I appreciate your support and look forward to your response.
Best regards,
Abdullah
Solved! Go to the solution
This is an accepted solution.
what's your store url ?
This is an accepted solution.
what's your store url ?
Go to your online store -> edit code -> theme.liquid file and before </body> tag paste this code there
<script>
document.addEventListener("DOMContentLoaded", function () {
function addDhsSpan(priceElement) {
if (priceElement) {
const text = priceElement.textContent.trim();
const match = text.match(/(Dhs\.)/);
if (match) {
const dhsSpan = document.createElement("span");
dhsSpan.className = "dhs-span";
dhsSpan.textContent = match[0];
dhsSpan.style.display = "none";
priceElement.appendChild(dhsSpan);
}
}
}
const regularPrice = document.querySelector(".price-item--regular");
const salePrice = document.querySelector(".price-item--sale");
addDhsSpan(regularPrice);
addDhsSpan(salePrice);
});
</script>
I really appreciate your support but there's nothing changed actually, so I'll look forward to know further tweaks in code and solutions, thanks.
Regards,
Abdullah.
remove the old code and use this
document.addEventListener("DOMContentLoaded", function () {
function addDhsSpan(priceElement) {
if (priceElement) {
let text = priceElement.textContent.trim();
let match = text.match(/(Dhs\.)\s*(\d+[.,]?\d*\s*AED)/);
if (match) {
priceElement.textContent = match[2];
const dhsSpan = document.createElement("span");
dhsSpan.className = "dhs-span";
dhsSpan.textContent = match[1]; // Store "Dhs."
dhsSpan.style.display = "none";
priceElement.prepend(dhsSpan);
}
}
}
const regularPrices = document.querySelectorAll(".price-item--regular");
const salePrices = document.querySelectorAll(".price-item--sale");
regularPrices.forEach(addDhsSpan);
salePrices.forEach(addDhsSpan);
});
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025