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?
- woocommerce 3.2.1 not sending order notification emails
- Integrating non-WooCommerce and WooCommerce Orders together [closed]
- Change the method of a class from child function.php
- Different UI in WordPress
- Override Javascript in a Plugin?
- WooCommerce Custom Product to checkout
- Woocommerce – How to populate custom select field with stored values on checkout page?
- What is the correct way to update both WP/plugins/themes without breaking the site?
- Redux Framework has an embedded demo. Click here to activate the sample config file
- Automatically add attributes to woocommerce product?
- Reduce Drop down Menu Width in WordPress
- Not getting author rank when using return
- How to Display a Plugin function (content) on frontpage using index.php
- The problem with WordPress Importer
- Why does my functions.php cause white-screen and media-library issues?
- How to make a slideshow shortcode based on the WordPress gallery shortcode? [closed]
- how to give a user a role?
- Admin Panel pagination link styles
- All of my custom posttypes are 404’ing
- Display post lists in 2nd paragraph
- How to stop activating a plugin and show admin notice when dependent plugins minimum version is not met
- Pagination Broken on Static Pages but Works on Blog Articles
- How to enable specific plugin only based around shop manager role?
- What are wsm tables for?
- WordPress automatically removes line break
- Why required field not working in Country dropdown in WooCommerce –
- Woocommerce API HTTP Response 401
- woocommerce_package_rates not fired when wordpress woocommerce accessed as non ajax
- How to use WP-CLI / WC-CLI to bulk import 1000s of products (variable and simple)?
- wp_get_post_terms is difference obj model than the one in rest api response
- Add woocommerce variation images in gallery?
- woocommerce payment gateway callback not firing [closed]
- How to modify WCMP Rest API response?
- Fetch Children of Grouped Products Inside WooCommerce Product Loop
- WordPress Keeps Logging Out – What Tests Can I Run to Solve This?
- Woocommerce dependent plugin
- How to check current user before all actions and filters?
- how to add a button next to the wordpress view button?
- New databes tables with – WooCommerce – for developers [closed]
- How to send an automated email to the customers when product is added woocommerce
- Modifying a .js Function for Print [QZ Tray, WooCommerce POS]
- WooCommerce: Building a page with user input which is used to query order status and external API and return a result
- woocommerce product countdown not showing in variable product? [closed]
- Change commission_status paid when withdraw_status vendor is completed
- 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 Deposit, then random payments until product paid in full [closed]
- How to toggle between two custom fields in WordPress woocommerce ‘WC Product Field Group’ plugin?
- custom payment gateway in woocommerce failed to connect to remote api server
- Classified ad website : which solutions to use? [closed]
- Programmatically Process Order through WooCommerce/Stripe Payment Gateway [closed]
- Replacing a plugin function with a custom renamed function doesn’t work
- CampaignMonitor for WooCommerce – Move subscribe button [closed]
- Multiple Billing forms in WooCommerce (one billing form per product)
- Creating a Callback URL for WordPress Woocommerce to update Order Status
- Change Product Addon price based on select Variation
- WooCommerce – Maximum qty per line per product
- Woocommerce Create custom product type with variations
- Remove /product/ from url. I want only category name then product name
- Pre booking doesn’t work with custom bootstrap modul in woocommerce [closed]
- WooCommerce specifc variations for specific user role [closed]
- Save custom attributes of product in woocommerce
- Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content
- Filtering WooCommerce Orders by Category
- Best place for short bio,image and button [closed]
- trying to get product category image in woo-coomerce
- Plugin dropping pagination variable
- How to add checkboxes for a woocommerce product? [closed]
- What are the specifics of WordPress development I need to know? [closed]
- Why am I getting ( WooCommerce Services could not be installed (Could not create directory.). ) error and how to solve it ?
- Product queue for my subscription box
- Want to Show Sub categories under Categories section using Woo Commerce [closed]
- WordPress shows error related to allow_url_fopen
- how to use in custom single.php template using php?
- how to do login using woocommerce rest api From android
- Custom Pages for Woocommerce Product-Category Pages
- Woocommerce Minimum Price for a Composite Product to add in cart
- How to create a code editor for my plugin .?
- creating a custom shop page display on archive woocommerce
- Finding the URL to be used to check if plugin is installed with a theme
- Js file is not adding using this code in functions.php
- wp_footer hook only working on homepage not in other pages
- How can I position ShareThis buttons manually when using the plug-in? [closed]
- Woocommerce Shop page variation product button replace with add to cart button
- Plugin can not display in my custom theme
- How can I insert thousands of Woocommerce products by batch with PHP? [closed]
- WooCommerce search products between price range using WP_Query
- How to use get_template part in the plugin?
- Jquery NoConflict Problem
- Overriding Parent Theme… will cause plugins failure?
- WordPress premium theme development [duplicate]