I am developing a product search plugin using parameters, I do this by AJAX
.
At the time of executing through the do_shortcode()
wordpress method it shows me correctly all the products but the pagination does not work
The pagination link and the URL it shows is as follows:
www.mipagina.com/wp-admin/admin-ajax.php?product-page=2
All AJAX requests in wordpress are made to that address admin-ajax.php
but the address that the shortcode
woocommerce should take is the one of the main page and not the one of theAJAX
The address should be the following:
www.mipagina.com/paginaactual/?product-page=2
Code:
//la lista de productos la genero mediante un for each
$listaProductos = "1,2,155,616,4454,123,3223,656565,656,8899,6565,655665,3232,9,5652,26262,888,0001";
if(!$listaProductos == "") {
echo do_shortcode("[products ids='$listaProductos' per_page='12' columns='3' paginate='true' limit='-1']");
}else{
echo "No hay productos disponibles.";
}
wp_die();
Temporary solution :
At the moment the solution was to remove the pagination and show a maximum of 30 products. With the following code:
As the project progresses I will update the status of this answer since another idea is to modify the "
href
" attribute of the products through Jquery