Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #4556297
After text options
Open

Comments

  •  1
    moni started the conversation

    how can I put the total saving on after text?

    total saving = saving per unit [a] X number of units

  •  1,688
    Dustin replied

    Hi Moni,

    Please add the custom code below. (How to add custom code? ↗):

    add_action( 'wp_footer', function () {
    	?>
    	<script type="text/javascript">
            (function($) {
                (function($) {
                    $(document).on('wpcpq_init_table', function(e, $table, total, qty) {
                        var ori_price = parseFloat($table.data('o_price'));
                        var ori_total = ori_price * qty;
    
                        if (ori_total > total) {
                            if ($table.find('.wpcpq-saved').length) {
                                $table.find('.wpcpq-saved').html('(Saved: ' + wpcpq_format_price(ori_total - total) + ')');
                            } else {
                                var saved = '<span class="wpcpq-saved" style="color: green; margin-left: 10px; font-weight: 400">(Saved: ' +
                                    wpcpq_format_price(ori_total - total) + ')</span>';
    
                                $table.find('.wpcpq-summary-total').append(saved);
                            }
                        } else {
                            $table.find('.wpcpq-saved').remove();
                        }
                    });
                })(jQuery);
            })(jQuery);
    	</script>
    	<?php
    }, 99 );

    The result will be like this:

    2138031118.png

    Best regards,
    Dustin

  •  1
    moni replied

    thanks Dustin

    1. it is not quite what I meant ... I was aiming to replace the (saved 10%) in your example to show the total saved ($ saving per unit X # of units)

    2.  I added it and it does not work. probably did not define the place to add correctly - see atached picture?

    Attached files:  add snippet.png

  •  1,688
    Dustin replied

    You should display "saved per unit" on the board to avoid confusing customers, as they may change the quantity to something different from what's shown there.

    1661709605.png

    3308213658.png

    Please configure the snippet like that:

    9406861943.png

    Best regards,
    Dustin

  •  1
    moni replied

    Hi Dustin.
    It still does not show...

  •  1
    moni replied

    OK, Found it... the snippet was inactive ... :-)