Home Forums WoodMart support forum pagination with query string in woocomerce

pagination with query string in woocomerce

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #255170

    nima ahmadi
    Participant

    Hi Good day,
    Happy New Year to you and your colleagues
    I want to change the pagination structure in WooCommerce pagination.php
    And I changed the force code to query string
    But when I click page 2, it only loads the ID of the first page,
    Thank you for helping me get rid of this structure
    The file is attached to you
    And I use this code
    For shop and blog pages I want the url structure to example.com/shop/?page=2
    This is how it comes to be
    Thank you
    With respect

    #255264

    Hello,

    Happy New Year!

    Please provide more details on how exactly you want to change the pagination, what you changed and were added the code I will check with the dev team if it is possible to implement.

    Best Regards

    #255355

    nima ahmadi
    Participant
    <?php
    /**
     * Pagination - Show numbered pagination for catalog pages
     *
     * This template can be overridden by copying it to yourtheme/woocommerce/loop/pagination.php.
     *
     * HOWEVER, on occasion WooCommerce will need to update template files and you
     * (the theme developer) will need to copy the new files to your theme to
     * maintain compatibility. We try to do this as little as possible, but it does
     * happen. When this occurs the version of the template file will be bumped and
     * the readme will list any important changes.
     *
     * @see     https://docs.woocommerce.com/document/template-structure/
     * @package WooCommerce\Templates
     * @version 3.3.1
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	exit;
    }
    $total   = isset( $total ) ? $total : wc_get_loop_prop( 'total_pages' );
    //$current = isset( $current ) ? $current : wc_get_loop_prop( 'current_page' );
    $current = get_query_var('page');
    // $base    = isset( $base ) ? $base : esc_url_raw( str_replace( 999999999, '%#%', remove_query_arg( 'add-to-cart', get_pagenum_link( 999999999, false ) ) ) );
    $base  = preg_replace('/\?.*/', '/?page=', get_pagenum_link(1)) . '%_%';
    // die($base);
    //$format  = isset( $format ) ? $format : '';
    $format = '?page=%#%';
    if ( $total <= 1 ) {
    	return;
    }
    ?>
    <nav class="woocommerce-pagination">
    	<?php
    	echo paginate_links(
    		apply_filters(
    			'woocommerce_pagination_args',
    			array( // WPCS: XSS ok.
    	          'base'               => '%_%',
                  'format'             => '?page=%#%',
                  'total'              => $total,
                  'current'            => get_query_var('page')??$_GET['page'],
                  'show_all'           => true,
    			)
    		)
    	);
    	?>
    </nav>

    This is the code we changed from woocommerce.php in the Woodmart directory

    #255485

    Artem Temos
    Keymaster

    Hello,

    We are sorry, but such customization of the WooCommerce plugin is out of our theme support scope. We don’t have a working instruction for this, unfortunately.

    Kind Regards

Viewing 4 posts - 1 through 4 (of 4 total)