Direct global $product
или global $post
не будет работать в глобальных шаблонах.
Вам нужно будет передать идентификатор продукта в качестве параметра из файла woocommerce / cart / cart.php , в который добавляется фильтр:
$product_quantity = woocommerce_quantity_input( array(
'input_name' => "cart[{$cart_item_key}][qty]",
'input_value' => $cart_item['quantity'],
'max_value' => $_product->get_max_purchase_quantity(),
'min_value' => '0',
'product_name' => $_product->get_name(),
'product_id' => $product_id
), $_product, false );
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item );
И тогда идентификатор продукта будет доступен в глобальном шаблоне. В вашем случае woocommerce / cart / amount-input.php вы можете получить доступ к идентификатору продукта, используя $args['product_id']