It seems there is no geoalgorithm to drop z values in the QGIS processing toolbox. Can this be done programmatically using the Python console? At the moment I have to save the layer with unchecked 'Include z-dimension' checkbox (non automatic geometry type):
Specifically, the QGIS 3 tool is called
Drop m/z values. It's in the Processing Toolbox, under Vector Geometry. The documentation is here:
Here is how i convert a QgsGeometry (geom) of type PolygonZ to a Polygon in the console:
new_geom = QgsGeometry().fromPolygonXY(geom.asPolygon())
It is some kind of workaround since there is no dedicated method for that. So i dont know if there are better ways to do it. Using the processing tool as recommended in the other answers would be the correct way if you want to convert a whole layer i guess.