The bottom line is that I’ve found how to do it, but then the page reloads and returns to the beginning, which is not good. It does not matter what topic, because the design is not important. The main thing! to be able to specify the number of products when added to the cart. 1) How to fasten a counter to an existing button? 2) how to make the page not update after a gross change in the content-product.php file
<?php defined( 'ABSPATH' ) || exit; global $product; if (empty(product)||! $product->is_visible() ) {return;}?> <li <?php wc_product_class(); ?> <?php do_action( 'woocommerce_before_shop_loop_item' ); do_action( 'woocommerce_before_shop_loop_item_title' ); do_action( 'woocommerce_shop_loop_item_title' ); do_action( 'woocommerce_after_shop_loop_item_title' ); do_action( 'woocommerce_after_shop_loop_item' ); ?> </li> <form class="cart" action="<?php echo esc_url( apply_filters( 'woocommerce_add_to_cart_form_action', $product->get_permalink() ) ); ?>" method="post" enctype='multipart/form-data'> <?php do_action( 'woocommerce_before_add_to_cart_button' ); ?> <?php do_action( 'woocommerce_before_add_to_cart_quantity' ); woocommerce_quantity_input( array( 'min_value' => apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ), 'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ), 'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( wp_unslash( $_POST['quantity'] ) ) : $product->get_min_purchase_quantity(), // WPCS: CSRF ok, input var ok. ) ); do_action( 'woocommerce_after_add_to_cart_quantity' ); ?> <button type="submit" data-quantity="1" data-product_id="<?php echo $product->id; ?>"class="button alt add_to_cart_button product_type_simple"><?php echo $product->single_add_to_cart_text(); ?></button> <?php do_action( 'woocommerce_after_add_to_cart_button' ); ?> </form> <?php do_action( 'woocommerce_after_add_to_cart_form' ); ?> <?php endif; ?> And yes ... I will be very happy if somebody advises a good course, literature for studying this engine ... otherwise it is hard for me to work with him without knowledge XD
