woocommerce loop qty
-
Hi
on my webiste kosherbasix.com i want to add a qty field in the loop, i found this woocommerce site https://docs.woocommerce.com/document/override-loop-template-and-show-quantities-next-to-add-to-cart-buttons/
saying to post in my function.php file the below. i did that but now if you go to my page https://kosherbasix.com/product-category/household/aluminum/ and hover over an item the qty field is covering the picture and the cart icon to add to cart is a RED slab instead of the icon.
is there something i am missing, a css code? maybe a better code than the below?/**
* Override loop template and show quantities next to add to cart buttons
*/
add_filter( ‘woocommerce_loop_add_to_cart_link’, ‘quantity_inputs_for_woocommerce_loop_add_to_cart_link’, 10, 2 );
function quantity_inputs_for_woocommerce_loop_add_to_cart_link( $html, $product ) {
if ( $product && $product->is_type( ‘simple’ ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) {
$html = ‘<form action=”‘ . esc_url( $product->add_to_cart_url() ) . ‘” class=”cart” method=”post” enctype=”multipart/form-data”>’;
$html .= woocommerce_quantity_input( array(), $product, false );
$html .= ‘<button type=”submit” class=”button alt”>’ . esc_html( $product->add_to_cart_text() ) . ‘</button>’;
$html .= ‘</form>’;
}
return $html;
}
- The topic ‘woocommerce loop qty’ is closed to new replies.