<div class="currency-switcher">
  <select id="currency-select">
    <option value="USD">USD</option>
    <option value="PKR">PKR</option>
  </select>
</div>
  
  
select {
    background-size: 4px 4px, 4px 4px;
    border-radius: 4px;
}
document.addEventListener('DOMContentLoaded', function() {
    const currencySelect = document.getElementById('currency-select');
    
    // Conversion rates (you can update this based on your latest rates)
    const conversionRates = {
        USD: 1,       // Base currency
        PKR: 285,     // Conversion rate from USD to PKR (example)
    };

    // Function to update prices
    function updatePrices(currency) {
        const elements = document.querySelectorAll('.woocommerce-Price-amount, p, label, .options-wrapper li label, .brxe-ltoycd brxe-text-basic');

        elements.forEach(element => {
            let priceText = element.innerText || element.textContent;

            // Skip non-price elements like "25% OFF"
            if (priceText.includes('% OFF')) return;

            // Match prices with currency symbols or numbers
            let matches = priceText.match(/(\$|€|₹|\d+(\.\d{1,2})?)/g);  // Match currency symbols and prices
            
            if (matches) {
                matches.forEach(match => {
                    // Remove the currency symbol and parse the number
                    let price = parseFloat(match.replace(/[^\d.-]/g, ''));

                    // If a valid price is found
                    if (!isNaN(price)) {
                        // Convert the price
                        let convertedPrice = price * conversionRates[currency];

                        // Format the price back with the appropriate currency symbol
                        let formattedPrice;
                        if (currency === 'USD') {
                            formattedPrice = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(convertedPrice);
                        } else if (currency === 'PKR') {
                            formattedPrice = `PKR ${new Intl.NumberFormat('en-IN').format(convertedPrice)}`; // Use Indian locale for PKR formatting
                        }

                        // Remove the existing currency symbol to avoid duplication
                        element.innerHTML = element.innerHTML.replace(match, formattedPrice);
                    }
                });
            }
        });
    }

    // Reload page when the currency changes
    currencySelect.addEventListener('change', function() {
        let selectedCurrency = currencySelect.value;
        localStorage.setItem('selectedCurrency', selectedCurrency); // Store the selected currency

        // Reload the page to properly reapply the conversion with the selected currency
        window.location.reload();
    });

    // Load the currency from localStorage
    const storedCurrency = localStorage.getItem('selectedCurrency') || 'USD';
    currencySelect.value = storedCurrency;
    updatePrices(storedCurrency);  // Apply the selected currency after reload
});

About Us

Welcome to the board
We’re your good host since 2005


About SpeedHost

Speedhost is a leading web hosting solutions company. Since our founding in 2005, Speedhost has continually innovated new ways to deliver on our mission: to empower people to fully harness the web. Based in Orem, Utah, we provide comprehensive tools to millions of users throughout the world so anyone, novice or pro, can get on the web and thrive with our web hosting packages.

 

9891

Sites Hosted

16891

Emails Hosted

12531

Sold Domains


OUR STORY

Back in 2001, we started SpeedHost as a small web hosting company and we never looked back. Everything has changed since then except for one – our passion for good web hosting. Now, we are catering to thousands of customers worldwide. As our customers increase day by day, likewise our quality of services. We are providing a complete package for the online journey. We help you in website building, domain name, web hosting, and finally advertising your website.