Add product usage class set to autoloader.

This commit is contained in:
Vedanshu Jain 2024-09-11 13:55:16 +05:30
parent c41293e1ef
commit fde245b18f
2 changed files with 4 additions and 8 deletions

View File

@ -21,7 +21,8 @@ class WC_Autoloader {
private $include_path = ''; private $include_path = '';
private static array $known_classes_paths = array( private static array $known_classes_paths = array(
'WC_Product_Usage' => WC_ABSPATH . 'includes/product-usage/class-wc-product-usage.php',
'WC_Product_Usage_Rule_Set' => WC_ABSPATH . 'includes/product-usage/class-wc-product-usage-rule-set.php',
); );
/** /**
@ -67,13 +68,13 @@ class WC_Autoloader {
* @param string $class Class name. * @param string $class Class name.
*/ */
public function autoload( $class ) { public function autoload( $class ) {
$class = strtolower( $class );
if ( isset( self::$known_classes_paths[ $class ] ) ) { if ( isset( self::$known_classes_paths[ $class ] ) ) {
$this->load_file( self::$known_classes_paths[ $class ] ); $this->load_file( self::$known_classes_paths[ $class ] );
return; return;
} }
$class = strtolower( $class );
if ( 0 !== strpos( $class, 'wc_' ) ) { if ( 0 !== strpos( $class, 'wc_' ) ) {
return; return;
} }

View File

@ -707,11 +707,6 @@ final class WooCommerce {
*/ */
include_once WC_ABSPATH . 'includes/wccom-site/class-wc-wccom-site.php'; include_once WC_ABSPATH . 'includes/wccom-site/class-wc-wccom-site.php';
/**
* Product Usage
*/
include_once WC_ABSPATH . 'includes/product-usage/class-wc-product-usage.php';
/** /**
* Libraries and packages. * Libraries and packages.
*/ */