Correction in Product Pricing Display

Solved

Correction in Product Pricing Display

abdullah__
Excursionist
24 0 7

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?

IMG-20250402-WA0043.jpg

And I found one option in currency related settings, here's the image:

IMG_20250402_184232.jpg

 

I appreciate your support and look forward to your response.

 

Best regards,

Abdullah

Accepted Solution (1)

Asad-Mahmood
Shopify Partner
398 67 76

This is an accepted solution.

what's your store url ?

 

If my solution has been helpful, you can consider supporting me via Buy Me a Coffee.
Hire me: asadmahmood8470@gmail.com
WhatsApp
Fiver




View solution in original post

Replies 5 (5)

Asad-Mahmood
Shopify Partner
398 67 76

This is an accepted solution.

what's your store url ?

 

If my solution has been helpful, you can consider supporting me via Buy Me a Coffee.
Hire me: asadmahmood8470@gmail.com
WhatsApp
Fiver




abdullah__
Excursionist
24 0 7
Asad-Mahmood
Shopify Partner
398 67 76

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>
If my solution has been helpful, you can consider supporting me via Buy Me a Coffee.
Hire me: asadmahmood8470@gmail.com
WhatsApp
Fiver




abdullah__
Excursionist
24 0 7

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.

Asad-Mahmood
Shopify Partner
398 67 76

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);
});
If my solution has been helpful, you can consider supporting me via Buy Me a Coffee.
Hire me: asadmahmood8470@gmail.com
WhatsApp
Fiver