How to fix 404 error in pagination in categories of woocommerce with common url base /shop/?

I had the same problem but on a custom archive-product.php page which contains a custom query to get my products with only 10 results per page.

I had 404 pages on shop page and categories page with the second page of pagination.

After analysis, I found that the main query of WooCommerce asks for 16 results but I had only 12 products in my database. So the main query returns nothing.

To change that, I need to do in admin : Appearance > Customize > WooCommerce > Product Catalog and change the value to 1 for Products per row and Rows per page.

With that the main query returns always 1 result and I had no more 404 pages.

I hope that will help you or another.

Source : https://docs.woocommerce.com/document/change-number-of-products-displayed-per-page/

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)