borlabs

WooCommerce fix - 4.4.0

Aug 19th, 2020 (edited)
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. Fix für WooCommerce 4.4.0. Quelle: https://github.com/woocommerce/woocommerce/issues/27394#issuecomment-675809919
  2.  
  3. Die Datei öffnen: /wp-content/plugins/woocommerce/includes/class-wc-query.php
  4.  
  5. In Zeile 376 diese Funktion suchen:
  6.  
  7. private function adjust_total_pages() {
  8.    
  9.     if ( 0 === wc_get_loop_prop( 'total_pages' ) ) {
  10.         wc_set_loop_prop( 'total_pages', $GLOBALS['wp_query']->max_num_pages );
  11.     }
  12. }
  13.  
  14. Die Funktion ersetzen mit:
  15.  
  16. private function adjust_total_pages() {
  17.        
  18.     if ( defined( 'WC_PLUGIN_FILE' ) && ! function_exists( 'wc_get_loop_prop' ) ) {
  19.         $woocommerce_file = dirname( WC_PLUGIN_FILE ) . '/includes/wc-template-functions.php';
  20.         if ( file_exists( $woocommerce_file ) ) {
  21.             require_once $woocommerce_file;                    
  22.         }
  23.     }
  24.    
  25.     if ( 0 === wc_get_loop_prop( 'total_pages' ) ) {
  26.         wc_set_loop_prop( 'total_pages', $GLOBALS['wp_query']->max_num_pages );
  27.     }
  28. }
Add Comment
Please, Sign In to add comment