/** * 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', 5, 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 = 'add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">'; $html .= woocommerce_quantity_input( array(), $product, false ); $html .= '' . esc_html( $product->add_to_cart_text() ) . ''; $html .= ''; } return $html; }
但是现在我的产品名称在添加到购物车和数量按钮下方。有什么想法可以管理代码来解决它吗?