Erro fatal em PlansController
-
Olá pessoal!
O plugin da Vindi está gerando um erro fatal no projeto. O problema está na linha 433 do arquivo src/controllers/PlansController.php.
Essa verificação do get_type() está totalmente incorreta, pois o método get_type() retorna o tipo do produto (simple, variable, grouped, etc) e não o tipo de post (post type).
$product = wc_get_product($post_id);
// Check if the post is product
if ($product->get_type() != 'product') {
return;
}Como o método wc_get_product() retorna false quando o produto não existe, então o correto deveria ser:
$product = wc_get_product($post_id);
if ( !$product ) {
return;
}Ou assim para verificar o post type:
if ( get_post_type($post_id) !== 'product' ) {
return;
}Apliquei a correção manual nos meus projetos, mas seria interessante a correção pelo plugin.
The topic ‘Erro fatal em PlansController’ is closed to new replies.