I’m using the following Woocommerce shortcode half way down a landing page:
[products author="4" columns="4" orderby="rand" order="DESC" visibility="visible" paginate="true" limit="24" class="allproducts"]
When clicking on the pagination buttons it loads the next page at the top of the landing page.
I have a div with the ID “#products” above the shortcode. I am trying to insert the ID into the pagination so when the next page loads, it will jump to the ID at the top of the products.
After Googling for hours I found this code and put it in functions.php but, while it jumps to the ID, it does not load the next page:
add_filter( 'woocommerce_pagination_args', 'd3c_pagination' );
function d3c_pagination( $args ) {
$args['add_fragment'] = '#products';
return $args;
}
I keep searching but I can’t find what I’m doing wrong or how to accomplish what I need.
Any help would be beyond appreciated.
A certain chatty AI found me a solution.
This solution does what I want perfectly.