Guest User

Untitled

a guest
Apr 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. add_filter( 'woocommerce_loop_add_to_cart_link', 'loc_quantity_inputs_for_woo_add_to_cart_link', 10, 2 );
  2. function loc_quantity_inputs_for_woo_add_to_cart_link( $html, $product )
  3. {
  4. if ( $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() )
  5. {
  6. $html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">';
  7. $html .= woocommerce_quantity_input( array(), $product, false );
  8. $html .= '<button type="submit" class="button alt">' . esc_html( $product->add_to_cart_text() ) . '</button>';
  9. $html .= '</form>';
  10. }
  11. return $html;
  12. }
Add Comment
Please, Sign In to add comment