Home / Archive / MemberPress: Modify ReadyLaunch Invoice Amount Text to Remove Dot from Swedish Kron (kr.)
Duplicate Snippet

Embed Snippet on Your Site

MemberPress: Modify ReadyLaunch Invoice Amount Text to Remove Dot from Swedish Kron (kr.)

Note: Works with the ReadyLaunch template only.

This code snippet removes the period (.) after the currency symbol for Swedish Kron (kr.) in all elements that contain the class .invoice-amount within the .mp-form-row container.

Code Preview
php
<?php
function custom_invoice_script() {
    ?>
    <script type="text/javascript">
    document.addEventListener("DOMContentLoaded", function() {
        // Get all elements with the class 'invoice-amount' within 'mp-form-row'
        var elements = document.querySelectorAll('.mp-form-row .invoice-amount');
        // Loop through each element
        elements.forEach(function(element) {
            // Get current text content
            var text = element.textContent;
            // Replace 'kr.' with 'kr'
            var newText = text.replace(/kr\./g, ' kr');
            // Update the element's text content
            element.textContent = newText;
        });
    });
    </script>
    <?php
}
add_action('wp_footer', 'custom_invoice_script');

Comments

Add a Comment