Home Forums WoodMart support forum Update Cart Automatically on Quantity Change

Update Cart Automatically on Quantity Change

Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #413921

    piyusharora981
    Participant

    I tried this code that you have posted on this topic

    https://xtemos.com/forums/topic/update-cart-automatically-on-quantity-change/#new-post

    Still quantity is not getting update, can you please check

    #413990

    Hello,

    Please navigate to Woodmart >> Patcher >> Apply the Mini cart patcher: https://ibb.co/NChncjc

    Then check back the site after removing the browser and site cache. I am sure your issue will be solved.

    Best Regards.

    #413992

    piyusharora981
    Participant

    No still not working please find the admin details to check further

    #414033

    Hello,

    Your given login details are not the administrator logins, please give me the admin access so I will check the issue and solve it on the site.

    Best Regards.

    #414043

    piyusharora981
    Participant

    I am sorry as I forgot to change the role of that user. now I have made it admin

    #414215

    piyusharora981
    Participant

    any update?

    #414398

    Hello,

    I have found that you are using the old version of the theme. Please update the theme to the latest Woodmart 7.0.3 version and update all the theme plugins as well. I am sure your issue will be solved.

    Please read and follow the instructions given in the theme documentation here about the theme update:

    https://xtemos.com/docs-topic/update-the-theme/

    Best Regards.

    #415664

    piyusharora981
    Participant

    I have updated the theme but still quantity not getting changed

    #415817

    Hello,

    Sorry to say but it was a third-party Plugin conflict on your Site.

    When we deactivated the Plugin “Cake Options WooCommerce” on your Site, the Automatically Update Quantity function was working fine on your Site. Right now, it is deactivated on your Site and you can check for yourself too.

    So, it is a third-party Plugin conflict not an issue at the Theme level.

    Best Regards.

    #415863

    piyusharora981
    Participant

    No still not working, please check even i cleared cache

    Attachments:
    You must be logged in to view attached files.
    #416068

    Hello,

    Sorry to say but it seems that you hadn’t read our reply earlier carefully.

    It was a third party Plugin conflict, the Plugin that we mentioned is currently active on your Site which is why the issue occurred again.

    Also, the Auto Update Cart functionality works on the Cart Off-Canvas style only which was affected by the mentioned Plugin.

    Whereas, the Shopping Cart page is the WooCommerce functionality and it works as it should (i.e. there you need to click on Update Cart button to make the Cart update) unfortunately, the WoodMart theme does not influence that

    Best Regards

    #416107

    iamfahrig
    Participant

    Update Cart Automatically on Quantity Change

    – CSS

    /* Remove cart update button */
    .woocommerce button[name="update_cart"],
    .woocommerce input[name="update_cart"] {
    	display: none;
    }

    – functions

    //Automatic cart update on click //
    
    add_action( 'wp_footer', 'cart_update_qty_script' );
    function cart_update_qty_script() {
      if (is_cart()) :
       ?>
        <script>
            jQuery('div.woocommerce').on('change', '.qty', function(){
               jQuery("[name='update_cart']").removeAttr('disabled');
               jQuery("[name='update_cart']").trigger("click"); 
            });
       </script>
    <?php
    endif;
    }
    • This reply was modified 2 years, 1 month ago by iamfahrig.
    Attachments:
    You must be logged in to view attached files.
    #416169

    Hello,

    So it means you have solved the issue by using that code?

    Let us know if there’s anything else we can do for you! You can always reach us at any time. We are always here to help you.

    Best Regards.

    #416187

    piyusharora981
    Participant

    thanks for the help but another code worked for me which I found somewhere else

    /* Update cart amounts when changing quantities */
    add_action( ‘wp_footer’, ‘wphelp_update_cart_when_changing_quantities’ );
    function wphelp_update_cart_when_changing_quantities() {
    if (is_cart()) :
    ?>
    <script>
    jQuery(‘div.woocommerce’).on(‘change’, ‘.qty’, function(){
    jQuery(“[name=’update_cart’]”).prop(“disabled”, false);
    jQuery(“[name=’update_cart’]”).trigger(“click”);
    });
    </script>
    <?php
    endif;
    }

    i am not good in code but i can see your code is almost similar with this code

    #416188

    piyusharora981
    Participant

    Well, how can we do the same thing on product page?

    #416200

    iamfahrig
    Participant

    Single Product Display Variable Product Total

    add_filter( 'woocommerce_available_variation', 'variable_product_total_amount_qty_change', 10, 3 );
    function variable_product_total_amount_qty_change( $data, $product, $variation ) {
    
        $data['price_html'] .= '<div id="product_total_price" class="total-price-qty variable_products">Ürün Toplamı: <span class="price">'.$data['display_price'].'</span></div>';
    ?>
        <script>
       jQuery(function($){
           jQuery( '.variations_form' ).each( function() {
        jQuery(this).on( 'found_variation', function( event, variation ) {
            console.log(variation);//all details here
    var price = variation.display_price;//selectedprice
            console.log(price);
    var currency = '<?php echo   get_woocommerce_currency_symbol(); ?>';            
            $('[name=quantity]').change(function(){
            if ((this.value > 1)) { 
     var product_total = parseFloat(price * this.value);
    $('#product_total_price').fadeIn();
     $('#product_total_price .price').html(currency + product_total.toFixed(2));
                    } else {
     $('#product_total_price').fadeOut();
                    }
            });
                    });
                });
            });  
    
        </script>
    <?php
    
    return $data;
    }
    Attachments:
    You must be logged in to view attached files.
    #416329

    Hello,

    Thanks for sharing the Snippet with us @iamfahrig, We appreciate that help 🙂


    @piyusharora981
    , you can check out the shared Snippet on your Site and see if this works out for you or not but kindly remember to make your complete Site Backup first before trying any Code Snippet into the Child Theme so that if anything goes wrong, you would have your Backup to get things back up and running.

    If you need any further assistance regarding any other issue, please try generating a new Topic. We will always be there for your help.

    Thanks for contacting us.
    Have a great day !

    Topic Closed.

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

The topic ‘Update Cart Automatically on Quantity Change’ is closed to new replies.