Home › Forums › WoodMart support forum › Update Cart Automatically on Quantity Change
Update Cart Automatically on Quantity Change
- This topic has 16 replies, 3 voices, and was last updated 2 years, 1 month ago by Aizaz Imtiaz Awan.
-
AuthorPosts
-
October 15, 2022 at 12:59 am #413921
piyusharora981ParticipantI 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
October 15, 2022 at 1:15 pm #413990
Aizaz Imtiaz AwanKeymasterHello,
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.
October 15, 2022 at 1:32 pm #413992
piyusharora981ParticipantNo still not working please find the admin details to check further
October 15, 2022 at 4:04 pm #414033
Aizaz Imtiaz AwanKeymasterHello,
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.
October 15, 2022 at 4:26 pm #414043
piyusharora981ParticipantI am sorry as I forgot to change the role of that user. now I have made it admin
October 17, 2022 at 12:20 am #414215
piyusharora981Participantany update?
October 17, 2022 at 2:52 pm #414398
Aizaz Imtiaz AwanKeymasterHello,
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.
October 21, 2022 at 5:04 pm #415664
piyusharora981ParticipantI have updated the theme but still quantity not getting changed
October 22, 2022 at 11:45 am #415817
Aizaz Imtiaz AwanKeymasterHello,
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.
October 22, 2022 at 4:06 pm #415863
piyusharora981ParticipantNo still not working, please check even i cleared cache
Attachments:
You must be logged in to view attached files.October 24, 2022 at 10:48 am #416068
Aizaz Imtiaz AwanKeymasterHello,
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
October 24, 2022 at 1:48 pm #416107
iamfahrigParticipantUpdate 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.October 24, 2022 at 4:09 pm #416169
Aizaz Imtiaz AwanKeymasterHello,
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.
October 24, 2022 at 5:08 pm #416187
piyusharora981Participantthanks 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
October 24, 2022 at 5:10 pm #416188
piyusharora981ParticipantWell, how can we do the same thing on product page?
October 24, 2022 at 6:00 pm #416200
iamfahrigParticipantSingle 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.October 25, 2022 at 10:22 am #416329
Aizaz Imtiaz AwanKeymasterHello,
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.
- This reply was modified 2 years, 1 month ago by Aizaz Imtiaz Awan.
- This reply was modified 2 years, 1 month ago by Aizaz Imtiaz Awan.
- This reply was modified 2 years, 1 month ago by Aizaz Imtiaz Awan.
-
AuthorPosts
The topic ‘Update Cart Automatically on Quantity Change’ is closed to new replies.
- You must be logged in to create new topics. Login / Register