• I am currently working on an eCommerce website, where I need the Product Price to Output the sum of the following equation:

    Product Price + (Character Count * £2)

    The Product Price is entered via the Product Page’s Back end.

    Character Count
    The Character Count counts how many letters a shopper enters into the Input Text Box. To achieve this Character Count, I entered the following jQuery code into the Single Product Template:

    <script type="text/javascript">	
    jQuery(document).on('keyup', '.product-custom-text', updateCount);
    jQuery(document).on('keydown', '.product-custom-text', updateCount);
    
    function updateCount() {
        var cs = jQuery(this).val().length;
        jQuery('#character_count').text(cs);
    }
    </script>

    Then, to Output the Character Count, I entered the following code into the functions.php file:

    <?php
    function letter_counter(){
        echo '<span id="character_count"></span>';
    }
    add_action('woocommerce_single_product_summary', 'letter_counter', 29);
    ?>

    Where I am now stuck is on putting together my Character Count and £2 and then ‘linking’ this to the get_price_html() function so that said function Outputs the above sum.

    Any suggestions, or directives, on how to achieve this would be greatly appreciated.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Is it possible to manipulate, in real time, `get_price_html()`?’ is closed to new replies.