Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter madwear

    (@madwear)

    Because this change of views of the cart inside my “side-cart” tells me that this has something to do with the templates. The cart.php-template of my child theme is different to the original woocommerce/templates/cart/cart.php file.

    Plugin Author Rishi Mehta

    (@rcreators)

    Hello Madwear,

    If you override woocommerce any template file with your theme one. It will directly adopt it. As its just passing to refresh cart Side bar widget and other fragments to refresh.

    Send me your website login details and website url. so i can check test it from my side.

    You can send me details through support form over here:
    https://rcreators.com/woocommerce-ajax-add-to-cart-variable-products/

    Plugin Author Rishi Mehta

    (@rcreators)

    Hello,

    I got your details, i think all things work fine. just that Quantity input field you can override At below location.

    Your_theme( child theme )/woocommerce/global/quantity-input.php

    Add input + and – button in this file and it will work everywhere into the website.

    Mark this ticked solved if that works or let me know if it don’t.

    Thread Starter madwear

    (@madwear)

    Hi,

    yes I have added this to my quantity-input.php:

    <div class="quantity buttons_added"><input type="button" value="-" class="minus">
    	<input type="number" step="1" min="0" max="22" name="cart[f3001defbd34a0b09741cbffd2a2c317][qty]" value="1" title="Menge" class="input-text qty text" size="4">
    <input type="button" value="+" class="plus"></div>

    The qty buttons are displayed now but unfortunately they don’t react after clicking. ?? Do you have an idea?

    Thanks!

    Thread Starter madwear

    (@madwear)

    sorry i meant i have this code inserted in quantity-input.php:

    if ( ! defined( 'ABSPATH' ) ) {
    	exit; // Exit if accessed directly
    }
    ?>
    <div class="quantity buttons_added">
    <input type="button" value="-" class="minus">
    	<input type="number" step="<?php echo esc_attr( $step ); ?>" min="<?php echo esc_attr( $min_value ); ?>" max="<?php echo esc_attr( $max_value ); ?>" name="<?php echo esc_attr( $input_name ); ?>" value="<?php echo esc_attr( $input_value ); ?>" title="<?php echo esc_attr_x( 'Qty', 'Product quantity input tooltip', 'woocommerce' ) ?>" class="input-text qty text" size="4" />
    <input type="button" value="+" class="plus"></div>
    </div>

    ——— EDIT ————-

    It works now – I had to add some jQuery:

    jQuery(document).ready(function($){
        $('.quantity').on('click', '.plus', function(e) {
            $input = $(this).prev('input.qty');
            var val = parseInt($input.val());
            $input.val( val+1 ).change();
        });
    
        $('.quantity').on('click', '.minus',
            function(e) {
            $input = $(this).next('input.qty');
            var val = parseInt($input.val());
            if (val > 0) {
                $input.val( val-1 ).change();
            }
        });
    });

    Thanks for your help!

    Plugin Author Rishi Mehta

    (@rcreators)

    Hello madwear,

    Glad you get it worked. Happy Coding ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Choose which cart-template is loaded’ is closed to new replies.