The button is disabled if there is nothing to update. Change the quantity of a product in the cart, then you can use the button to update the cart.
Hi Caleb Burks
thank you so much
i changed the quantity of a product in this page: http://www.meroeh.com/cart
and update cart button was activated.
but when I add a new product from the store to the basket and stay in this page: http://www.meroeh.com/cart I expect that new product by pressing the update cart button to be added to the list of purchases on this page.
While the new product is purchased from the store just by refresh this page is displayed on the purchase list as well as the update cart button is disabled.
can you help me please?
Hmm, I don’t think the update cart button is meant to work for that scenario. It is mainly there so quantities can be changed and saved.
Some custom JS can permanently remove the disabled attribute for you:
jQuery(document).ready(function() {
jQuery( '.shop_table.cart' ).closest( 'form' ).find( 'input[name="update_cart"]' ).removeProp( 'disabled');
});
thank you so much Caleb Burks for your help.
can you tell me where I add this code?
jQuery(document).ready(function() {
jQuery( ‘.shop_table.cart’ ).closest( ‘form’ ).find( ‘input[name=”update_cart”]’ ).removeProp( ‘disabled’);
});
thank you
hi Caleb Burks
I’ve added code to the right place, but still the button is disabled.
So you know why?
Nope, not sure why. It worked for me on my test site. I’m guessing you haven’t added it in the right place though.
Try adding this PHP snippet:
function wc_ninja_remove_disabled_attr() {
?>
<script type='text/javascript'>
jQuery(document).ready(function() {
jQuery( '.shop_table.cart' ).closest( 'form' ).find( 'input[name="update_cart"]' ).removeProp( 'disabled');
});
</script>
<?php
}
add_action( 'wp_footer', 'wc_ninja_remove_disabled_attr', 99 );
hi Caleb Burks
thank you for your help, it is ok.
thank you soooo much 🙂
hi Caleb Burks
I want that after hitting the “به روز رسانی سبد خرید” button at the top of page “سبد خرید به روز شد” message is displayed.
But by adding new code message is not displayed.
can you help me please?
If you update the cart when there is nothing to be updated, then no message will be displayed as nothing was updated…
Hi Caleb Burks
No i update the cart by add the product to my cart in the store. and
then I hit the “به روز رسانی سبد خرید” button. i was expecting after hitting the “به روز رسانی سبد خرید” button, update message is displayed.
The update message is meant to work for quantity changes. This whole “multiple windows” thing isn’t what it was built for.
It’ll take some more customization on your part to work for this. To be honest though, I’m not sure you are going to have people opening up multiple windows on your site. That is not usual behavior, and those that do that should be used to refreshing the page.