It has to do with the posts_per_page being 2 and the backend WordPress Settings being a greater value. If you set your WordPress Settings to 2 it will work. But you may not want all your pages to have two posts. In that case you can alter the query using the code in this answer, Pagination Throws 404 just for that archive page.
Here is the code to put in your theme’s function.php file.
if( !is_admin() ){
add_action( 'pre_get_posts', 'set_per_page' );
}
function set_per_page( $query ) {
global $wp_the_query;
if($query->is_post_type_archive('product')&&($query === $wp_the_query)){
$query->set( 'posts_per_page', 1);
}
return $query;
}
This changes the posts_per_page before running your query. Then when you get your posts it has your query with the dynamic variable posts_per_page. So if that number is 3, you will get your 3 products per page and no 404 error.
Related Posts:
- Create WooCommerce Product Category Programmatically
- Dropdown menu on custom page with product to choose number of products per page
- How to show only next post pagination link using wp_link_pages()
- Redirect to another page using contact form 7? [closed]
- Woocommerce singe product custom gallery output works just on the first slide
- Remove Pagination for Product Category Pages WooCommerce
- woocommerce remove coupon link does not work
- woocommerce: Customize email with item total count
- How can I find related learndash course id from woocommerce product object?
- How to Display Product specific to a category with WooCommerce Plugin? [closed]
- Woocommerce hook after creating order? [closed]
- Can I make plugins required?
- How to authenticate custom API endpoint in WooCommerce [closed]
- WordPress tips for speed and performance [closed]
- How to access options of Redux framework in front end
- Integrating plugins in themes
- Translate third party plugin and save translation files in custom theme
- Add CSS class to add-to-cart button, Woocommerce [closed]
- How do I future proof my older WordPress theme?
- Remove action from woocommerce barcode plugin [closed]
- Override core woocommerce class
- WooCommerce – Where is functions.php?
- register_theme_directory somehow “fails” when folder is outside of WP-Folder
- Display future posts?
- How to add pagination to wpbakery grid?
- XML sitemap over product variations
- How can I display a contact form for out of stock products in WooCommerce?
- HTML in WooCommerce settings
- How to use get_theme_mod in gutenberg editor wordpress?
- Why required field not working in Country dropdown in WooCommerce –
- How to check current user before all actions and filters?
- I want to disable Cash on delivery based on product tag in woocommerce Checkout Page [closed]
- Is there a way to create custom product templates based on category on WooCommerce?
- WooCommerce specifc variations for specific user role [closed]
- How to get a list of bundled products using wp_query in woocommerce
- multiple language website navigation menu suggestion
- Release the plugin in the WordPress repository where redux is used
- How to get the particular product quantity in orders in Woocommerce [closed]
- Custom template for all woo commerce categories
- why need theme,if page builder is there in wordpress [closed]
- Is it possible to instantiate a new WC_Cart?
- speed up pagination for huge database
- Sell access to form [closed]
- I want to filter my products with attributes [closed]
- How do you create a re-useable HTML fragment in wordpress
- Identify current wordpress theme
- Update WordPress Theme System
- Permalinks and pagination are not working in WordPress with WP e-Commerce plugin
- Automatic recurring payment using YITH subscription and Dokan Stripe
- Code for unique user visit count on every page WordPress
- apply_filters(woocommerce_get_item_data, …) Causing errors when adding to cart
- Change Dashboard URL from wp-admin to wp-admin/index.php
- How To Use do_shortcode with WooCommerce One Page Checkout
- How to makes changes on the shop/category/tag pages but not on the product pages in woocommerce?
- Widgets are not displaying in the admin panel
- Hide fields in woocommerce settings
- Content-Security-Policy implementation with WordPress W3Total Cache plugin installed
- Save order without sending the invoice / order details woocommerce [closed]
- show wc_add notices on particular page in woo commerce custom plugin development
- Child theme modifications not showing up
- Make modification of add_to_cart button specific to single page
- How to get the checkout form data from checkout page when place-order button is clicked
- Product Page loads terribly slow when product gallery images are added
- How to make WooCommerce multiple filter with custom meta fields
- One WooCommerce Store to multi distributor sites
- best way to handle subscriptions with a licence?
- Is there a request for products plugin for WooCommerce
- Showing different js file for different theme in wordpress customizer api
- woocommerce with external ftp site
- Only return taxonomies that are linked to a category & product
- WordPress eMails not working
- Add WooCommerce vendor slug to auto-generated SKU
- Custom plugin issue – Notice: Trying to get property of non-object in
- How to wrap image tag into div for post only?
- how to make settings page for woocommerce plugin?
- redirect to a custom page
- Add section (add_settings_section) to a custom page (add_submenu_page) not working
- Change value of Points earned in product data
- Problem with conditional woocommerce custom checkout field
- Why the output of an image gallery plugin is not displayed into a page of my custom theme?
- How woo-commerce store Product Data value in DB?
- Not getting result using ajax on wordpress
- Which WordPress version to use for improved plugin compatibility? [closed]
- Convert HTML5/CSS3 site to WordPress Theme (need a lot of plugins) or just use the API?
- Plugin’s required JS not being inserted in my theme
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- What is the Object for WP_Error Class?
- Pagination adds product to cart Woo-Commerce
- Replace all media (images)
- Apostrophes replaced by '
- Woocommerce – Product Description heading [closed]
- Visual Composer Data Source?
- Woocommerce disable checkout on specific day
- Woocommerce where to set the Price Suffix [closed]
- Is there a method or plugin to download my products in WooCommerce?
- How to create a “plugin” or “block” that can manipulate WordPress DOM in frontend?
- Template selector for woocommerce product
- Plugin Icon does not work correctly
- Convert from Portfolio post to WooCommerce products [closed]
- Per-Day booking with customer-supplied start time using Woocommerce Bookings