Это код, который у меня есть, и он отлично работает.
Код: Выделить всё
function custom_add_to_cart_button_with_quantity_shortcode($atts) {
$product_id = isset($atts['product_id']) ? intval($atts['product_id']) : null;
if ($product_id) {
ob_start();
?>
Подробнее здесь: [url]https://stackoverflow.com/questions/78661510/woocommerce-custom-add-to-cart-with-quantity-buttons[/url]
Мобильная версия