As Andy mentioned, you’re calling WCS_DIR
, but that doesn’t exist. Updated the code to call WCT_DIR
instead:
define( 'WCT_DIR', plugin_dir_path( __FILE__ ) );
add_filter( 'template_include', 'wdm_load_template', 99 );
function wdm_load_template( $template ) {
$template_slug = basename( rtrim( $template, '.php' ) );
if ( ($template_slug === 'single-product' || $template_slug === 'woocommerce') && is_product() ) {
$template = WCT_DIR . 'includes/wcs-templates.php';
}
return $template;
}