Ответы в темах

Просмотр 1 ответа (всего 1)
  • Решил проблему добавив в functions.php след. код:

    function cart_buttons () {

    if( ! is_admin() ) { ?>
    <script>
    jQuery(document).ready(function($){

    $(document).on(‘click’, ‘.plus’, function(e) { // replace ‘.quantity’ with document (without single quote)
    $input = $(this).prev(‘input.qty’);
    var val = parseInt($input.val());
    var step = $input.attr(‘step’);
    step = ‘undefined’ !== typeof(step) ? parseInt(step) : 1;
    $input.val( val + step ).change();
    });
    $(document).on(‘click’, ‘.minus’, // replace ‘.quantity’ with document (without single quote)
    function(e) {
    $input = $(this).next(‘input.qty’);
    var val = parseInt($input.val());
    var step = $input.attr(‘step’);
    step = ‘undefined’ !== typeof(step) ? parseInt(step) : 1;
    if (val > 0) {
    $input.val( val — step ).change();
    }
    });
    });
    </script>
    <?php }
    }
    add_action( ‘wp_footer’, ‘cart_buttons’ );

    • Ответ изменён 4 года, 4 месяца назад пользователем rndsand81.
    • Ответ изменён 4 года, 4 месяца назад пользователем rndsand81.
Просмотр 1 ответа (всего 1)