Skip to content

Instantly share code, notes, and snippets.

@webuti
Created April 27, 2017 10:44
Show Gist options
  • Save webuti/12ff60d50234ba2d77245506c7bdae07 to your computer and use it in GitHub Desktop.
Save webuti/12ff60d50234ba2d77245506c7bdae07 to your computer and use it in GitHub Desktop.
woocommerce sepete adetli ekletme
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 product_type_simple add_to_cart_button ">' . esc_html( $product->add_to_cart_text() ) . '</button>';
$html .= '</form>';
}
return $html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment