Community
Administrator
Staff member
Error PHP Fatal error: Uncaught Error: Class "Automattic\WooCommerce\Enums\ProductStockStatus" not found in /wp-content/plugins/seo-by-rank-math/includes/modules/schema/snippets/class-product-woocommerce.php:353
Latest Rank Math relies on the latest version of woocommerce, obviously some people may not be running the latest version of woocommerce yet.
Adding this to the functions resolves it :
}
Latest Rank Math relies on the latest version of woocommerce, obviously some people may not be running the latest version of woocommerce yet.
Adding this to the functions resolves it :
Code:
add_action( 'after_setup_theme', function (){if ( ! class_exists( '\Automattic\WooCommerce\Enums\ProductStockStatus' ) ){// Define a minimal replacement matching the values older WC returns from get_stock_status().
class_alias( 'RM_WC_ProductStockStatus_Shim', '\Automattic\WooCommerce\Enums\ProductStockStatus' );
}
}, 0 );
if ( ! class_exists( 'RM_WC_ProductStockStatus_Shim' ) ){class RM_WC_ProductStockStatus_Shim {
public const IN_STOCK = 'instock';
public const OUT_OF_STOCK = 'outofstock';
public const ON_BACKORDER = 'onbackorder';
}
Elementor Services