Select Page

– & + issue in cart

Home Forums Support – & + issue in cart

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • Helpful
    Up
    0
    Down
    Not Helpful

    Hi!

    I’m trying to use the new option to style the quantity inputs with + & -.

    Looks great and the function is as expected on product pages. But in the cart the + symbol is not working and after updating the cart both – & + symbols are gone.

    I’m working on a password protected testsite, but I can email you links and password if you need it. 🙂

    BW Christian

    Helpful
    Up
    1
    Down
    Not Helpful

    Noted, we are looking into this for the next update!

    Helpful
    Up
    1
    Down
    Not Helpful

    I second the issue on the +/- buttons on the cart page.

    Helpful
    Up
    1
    Down
    Not Helpful

    An update has just been released with this fix (3.3) – please update and let me know 😀

    Helpful
    Up
    0
    Down
    Not Helpful

    Works and looks great!

    However – before using your styling I used the function below to autoupdate the cart when changing the quantity with the up-/downbuttons. Can you tell me what to change in the function to make it work with your buttons?

    function bbloomer_cart_refresh_update_qty() {
    if (is_cart()) {
    ?>
    <script type=”text/javascript”>
    jQuery(‘div.woocommerce’).on(‘click’, ‘input.qty’, function(){
    jQuery(“[name=’update_cart’]”).trigger(“click”);
    });
    </script>
    <?php
    }
    }

    Helpful
    Up
    1
    Down
    Not Helpful

    Try changing it to:

    
    function bbloomer_cart_refresh_update_qty() {
    if (is_cart()) {
    ?>
    <script type="text/javascript">
    jQuery(document).ready(function( $ ) {
    
    // on addition, auto update cart
    $(document).on("click", '.add', function() {
    var max = $(this).closest(".quantity").find("input").attr("max");
    if (max == "") { max = "999";}
    var val = $(this).closest(".quantity").find("input").val();
    if (val >= max) {
    } else {
    $("button[name='update_cart']").prop('disabled', false);
    $("[name='update_cart']").trigger("click");
    }
    });
    
    // on subtraction, auto update cart
    $(document).on("click", '.sub', function() {
      if ($(this).closest(".quantity").find(".qty").val() > 1) {
    $("button[name='update_cart']").prop('disabled', false);
    $("[name='update_cart']").trigger("click");
      }
    });
    
    // Add the quantity buttons with ajax
    $(document).ajaxSuccess(function() {
    $(".quantity").prepend('<button type="button" id="sub" class="sub"></button>');
    $(".quantity").append('<button type="button" id="add" class="add"></button>');
    });
     
     });
    </script>
    <?php
    }
    }
    

    Let me know if this works?

    Helpful
    Up
    0
    Down
    Not Helpful

    Thanks – this function updates the cart – but now the buttons no longer changes the quantity and therefore there is no change… 🙂

    Helpful
    Up
    1
    Down
    Not Helpful

    Sorry but the auto update is custom work so cannot support that now.

    I will add this to the feature request list and see if I can get this for the next update.

    Will let you know

    Helpful
    Up
    0
    Down
    Not Helpful

    BTW: in mobileview the quantitynumber is plasec under the +-sign.

    Helpful
    Up
    0
    Down
    Not Helpful

    I have just released the update (version 3.3.1) – please update and let me know 😀

    Helpful
    Up
    0
    Down
    Not Helpful

    Thanks! I still had the issue with mobile wiev, but solved it with this bit of css:
    input.input-text.qty.text {
    min-width: 100%;
    padding-left: 21px;
    padding-right: 21px;
    }

    To make the autoupdate work I had to add a little delay before the click:

    add_action( ‘wp_footer’, ‘bbloomer_cart_refresh_update_qty’ );

    function bbloomer_cart_refresh_update_qty() {
    if (is_cart()) {
    ?>
    <script type=”text/javascript”>
    jQuery(document).ready(function( $ ) {

    // on addition, auto update cart
    $(document).on(“click”, ‘.add’, function() {
    var max = $(this).closest(“.quantity”).find(“input”).attr(“max”);
    if (max == “”) { max = “999”;}
    var val = $(this).closest(“.quantity”).find(“input”).val();
    if (val >= max) {
    } else {
    setTimeout(function(){
    $(“button[name=’update_cart’]”).prop(‘disabled’, false);
    $(“[name=’update_cart’]”).trigger(“click”);
    }, 500);
    }
    });

    // on subtraction, auto update cart
    $(document).on(“click”, ‘.sub’, function() {
    if ($(this).closest(“.quantity”).find(“.qty”).val() > 1) {
    $(“button[name=’update_cart’]”).prop(‘disabled’, false);
    setTimeout(function(){
    $(“[name=’update_cart’]”).trigger(“click”);
    }, 500);
    }
    });

    // Add the quantity buttons with ajax
    $(document).ajaxSuccess(function() {
    $(“.quantity”).prepend(‘<button type=”button” id=”sub” class=”sub”></button>’);
    $(“.quantity”).append(‘<button type=”button” id=”add” class=”add”></button>’);
    });

    });
    </script>
    <?php
    }
    }

    Thanks again! 🙂

    Helpful
    Up
    0
    Down
    Not Helpful

    Cool – glad you got it sorted 😀

    Have a great week!

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.