Skip to content

Instantly share code, notes, and snippets.

@jartes
Created March 25, 2014 17:58
Show Gist options
  • Save jartes/9767468 to your computer and use it in GitHub Desktop.
Save jartes/9767468 to your computer and use it in GitHub Desktop.
WooCommerce - Add "update cart" button on all cart items . Props igmoweb
<?php
function fanatic_add_update_cart_item( $product_quantity, $cart_item_key ) {
global $woocommerce;
$cart = $woocommerce->cart->get_cart();
$product = $cart[ $cart_item_key ]['data'];
$product_id = $product->id;
if ( $product->is_sold_individually() === false ) {
$product_quantity .= '<input type="submit" class="update-qty" name="update_cart" value="'.__( 'Update Cart', 'woocommerce' ).'" />';
}
return $product_quantity;
}
add_filter( 'woocommerce_cart_item_quantity', 'fanatic_add_update_cart_item', 10, 2 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment