Home › Forums › WoodMart support forum › Add count quantati to shop pages › Reply To: Add count quantati to shop pages
April 19, 2018 at 5:16 am
#53244
kooljohny
Participant
after adding next code
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;
}
code
quantity option appear but button “add to cart” work wrong(does not add items to the shopping cart)
I thik this issue connected with tag “$html .= ‘<button type=”submit” class=”button alt”>’ . esc_html( $product->add_to_cart_text() ) . ‘</button>’;”
You can see how it work here