diff --git a/pint/numpy_func.py b/pint/numpy_func.py
index 8501a7e..7188071 100644
--- a/pint/numpy_func.py
+++ b/pint/numpy_func.py
@@ -670,6 +670,28 @@ def _all(a, *args, **kwargs):
         raise ValueError("Boolean value of Quantity with offset unit is ambiguous.")
 
 
+@implements("prod", "function")
+def _prod(a, *args, **kwargs):
+    arg_names = ("axis", "dtype", "out", "keepdims", "initial", "where")
+    all_kwargs = dict(**dict(zip(arg_names, args)), **kwargs)
+    axis = all_kwargs.get("axis", None)
+    where = all_kwargs.get("where", None)
+
+    if axis is not None and where is not None:
+        raise ValueError("passing axis and where is not supported")
+
+    result = np.prod(a._magnitude, *args, **kwargs)
+
+    if axis is not None:
+        exponent = a.size // result.size
+        units = a.units ** exponent
+    elif where is not None:
+        exponent = np.asarray(where, dtype=np.bool_).sum()
+        units = a.units ** exponent
+
+    return units._REGISTRY.Quantity(result, units)
+
+
 # Implement simple matching-unit or stripped-unit functions based on signature
 
 

Quantity.prod() result unit is incorrect with axis or where argument
Right now, the `.prod()` method assumes the full size of the input is collapsed in the result. This gives incorrect results when the `axis` or `where` arguments are supplied, as seen below:

```python
import pint

ureg = pint.UnitRegistry()

q = [[1, 2], [3, 4]] * ureg.m

print(q.prod())
print(q.prod(axis=0))
print(q.prod(where=[True, False]))
```
```
24 meter ** 4
[3 8] meter ** 4
3 meter ** 4
```

The unit on the first result where the full array is collapsed to a scalar is correct, but the other two results should have `meter ** 2` as the unit.

I don't have a good fix for this yet, since this is the same problem mentioned in https://github.com/hgrecco/pint/pull/764#issuecomment-523749008. If anyone has any suggestions for a performant way to determine how many unit multiplications occur given both `axis` and `where` arguments, please do let me know! Otherwise, I'll try to figure something out and get a PR in for this or include it alongside a `prod` implementation for `__array_function__`.
diff --git a/pint/testsuite/test_numpy.py b/pint/testsuite/test_numpy.py
index fd12bf5..594bde0 100644
--- a/pint/testsuite/test_numpy.py
+++ b/pint/testsuite/test_numpy.py
@@ -286,6 +286,16 @@ class TestNumpyMathematicalFunctions(TestNumpyMethods):
     def test_prod(self):
         self.assertEqual(self.q.prod(), 24 * self.ureg.m ** 4)
 
+    @helpers.requires_array_function_protocol()
+    def test_prod_numpy_func(self):
+        axis = 0
+        where = [[True, False], [True, True]]
+
+        self.assertQuantityEqual(np.prod(self.q, axis=axis), [3, 8] * self.ureg.m ** 2)
+        self.assertQuantityEqual(np.prod(self.q, where=where), 12 * self.ureg.m ** 3)
+
+        self.assertRaises(ValueError, np.prod, self.q, axis=axis, where=where)
+
     def test_sum(self):
         self.assertEqual(self.q.sum(), 10 * self.ureg.m)
         self.assertQuantityEqual(self.q.sum(0), [4, 6] * self.ureg.m)

pip install -e .
parse_log_pytest
pytest
pytest pytest-cov pytest-mpl
3.7
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///croot/attrs_1668696182826/work
certifi @ file:///croot/certifi_1671487769961/work/certifi
coverage==7.2.7
cycler==0.11.0
flit_core @ file:///opt/conda/conda-bld/flit-core_1644941570762/work/source/flit_core
fonttools==4.38.0
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1648562407465/work
importlib-resources==5.12.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
Jinja2==3.1.6
kiwisolver==1.4.5
MarkupSafe==2.1.5
matplotlib==3.5.3
numpy==1.21.6
packaging @ file:///croot/packaging_1671697413597/work
Pillow==9.5.0
-e git+https://github.com/hgrecco/pint.git@878f81e75dc61f7fe58e64c927fe2da939aca0dd#egg=Pint
pluggy @ file:///tmp/build/80754af9/pluggy_1648042572264/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing==3.1.4
pytest==7.1.2
pytest-cov==4.1.0
pytest-mpl==0.17.0
python-dateutil==2.9.0.post0
six==1.17.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions @ file:///croot/typing_extensions_1669924550328/work
zipp @ file:///croot/zipp_1672387121353/work

name: pint
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=22.1.0=py37h06a4308_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - flit-core=3.6.0=pyhd3eb1b0_0
  - importlib-metadata=4.11.3=py37h06a4308_0
  - importlib_metadata=4.11.3=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=22.0=py37h06a4308_0
  - pip=22.3.1=py37h06a4308_0
  - pluggy=1.0.0=py37h06a4308_1
  - py=1.11.0=pyhd3eb1b0_0
  - pytest=7.1.2=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py37h06a4308_0
  - typing_extensions=4.4.0=py37h06a4308_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.11.0=py37h06a4308_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - coverage==7.2.7
      - cycler==0.11.0
      - fonttools==4.38.0
      - importlib-resources==5.12.0
      - jinja2==3.1.6
      - kiwisolver==1.4.5
      - markupsafe==2.1.5
      - matplotlib==3.5.3
      - numpy==1.21.6
      - pillow==9.5.0
      - pint==0.12.dev80+g878f81e
      - pyparsing==3.1.4
      - pytest-cov==4.1.0
      - pytest-mpl==0.17.0
      - python-dateutil==2.9.0.post0
      - six==1.17.0
prefix: /opt/conda/envs/pint

pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_prod_numpy_func
pint/testsuite/test_numpy.py::TestNumpyArrayCreation::test_empty_like pint/testsuite/test_numpy.py::TestNumpyArrayCreation::test_full_like pint/testsuite/test_numpy.py::TestNumpyArrayCreation::test_ones_like pint/testsuite/test_numpy.py::TestNumpyArrayCreation::test_zeros_like pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_append pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_astype pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_atleast_1d pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_atleast_2d pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_atleast_3d pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_block_column_stack pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_broadcast_to pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_concat_stack pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_expand_dims pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_flat pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_flatten pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_flip_numpy_func pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_item pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_moveaxis pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_ravel pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_ravel_numpy_func pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_reshape pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_rollaxis pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_squeeze pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_swapaxes pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_transpose pint/testsuite/test_numpy.py::TestNumpyArrayManipulation::test_transpose_numpy_func pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_addition_with_incompatible_scalar pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_addition_with_scalar pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_cbrt pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_cross pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_cumprod pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_cumprod_numpy_func pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_diff pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_dot pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_dot_numpy_func pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_ediff1d pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_einsum pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_fix pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_gradient pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_nancumprod_numpy_func pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_nansum_numpy_func pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_power pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_prod pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_solve pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_sqrt pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_sum pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_sum_numpy_func pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_trapz pint/testsuite/test_numpy.py::TestNumpyMathematicalFunctions::test_unwrap pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_alen_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_all_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_allclose pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_any_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_argmax pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_argmax_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_argmin pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_argmin_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_argsort pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_argsort_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_array_protocol_unavailable pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_average_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_clip pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_clip_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_comparisons pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_compress pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_compress_nep18 pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_conj pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_copy_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_copyto pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_count_nonzero_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_cumprod pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_cumsum pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_cumsum_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_diagonal pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_diagonal_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_equal pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_fabs pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_fill pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_getitem pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_insert pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_interp_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_intersect1d pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_isclose_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_isin pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_iterable pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_iterator pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_max pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_max_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_max_with_axis_arg pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_max_with_initial_arg pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_maximum pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_mean pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_mean_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_median_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_meshgrid_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_min pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_min_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_min_with_axis_arg pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_min_with_initial_arg pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_minimum pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_nan_to_num_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_nanargmax_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_nanargmin_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_nancumsum_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_nanmax pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_nanmean_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_nanmedian_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_nanmin pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_nanpercentile pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_nanquantile pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_nanstd_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_nanvar_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_ndarray_downcast pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_ndarray_downcast_with_dtype pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_ndim_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_nonzero pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_nonzero_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_pad pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_percentile pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_pickle pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_prod pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_ptp pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_ptp_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_put pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_quantile pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_repeat pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_resize pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_result_type_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_reversible_op pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_rot90 pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_round pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_round_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_searchsorted pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_searchsorted_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_setitem pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_shape pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_shape_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_sort pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_sort_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_std pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_std_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_take pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_tile pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_tolist pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_trace pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_trim_zeros_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_var pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_var_numpy_func pint/testsuite/test_numpy.py::TestNumpyUnclassified::test_where
pint/numpy_func.py
pint/numpy_func.py