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
1 Like
Go to your online store → edit code → theme.liquid file and before tag paste this code there
1 Like
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);
});
1 Like