Por padrão, a maioria dos campos de produto enviados ao Ebit (categoria, marca, fabricante, submarca) vai vazia. Esse artigo mostra como preencher cada um a partir das fontes da sua loja.
Por que isso importa
O Ebit usa esses campos pra agrupar pesquisas, calcular reputação por categoria/marca, e mostrar dados agregados pra outros consumidores. Quanto mais completo, melhor sua presença na plataforma.
Configurar EAN via meta field
Caso simples: você já armazena o EAN num meta field por produto.
- Vá em WooCommerce → Configurações → Integração → Ebit.
- Em Campo para Código EAN, coloque o nome do meta (ex:
_ean_code). - Salve.
Pronto. O plugin lê o meta de cada produto e envia automaticamente.
EAN dinâmico (sem meta field)
Se o EAN vem de outro lugar (API externa, taxonomia, gerado a partir do SKU):
add_filter( 'wc_ebit_eanCode', function( $ean, $product, $item ) {
if ( $ean ) {
return $ean;
}
// exemplo: gerar a partir do SKU
$sku = $product->get_sku();
return $sku ? '789' . str_pad( crc32( $sku ), 10, '0', STR_PAD_LEFT ) : '';
}, 10, 3 );
Categoria (CategoryL5)
O Ebit aceita até 5 níveis hierárquicos de categoria. O plugin envia só o nível 5 — geralmente a categoria mais específica.
Pegando da taxonomia product_cat do WooCommerce, deepest-first:
add_filter( 'wc_ebit_CategoryL5', function( $category, $product ) {
$terms = get_the_terms( $product->get_id(), 'product_cat' );
if ( ! $terms || is_wp_error( $terms ) ) {
return $category;
}
// ordena por profundidade (term_id maior = geralmente mais profundo)
usort( $terms, fn( $a, $b ) => $b->term_id - $a->term_id );
return $terms[0]->name;
}, 10, 2 );
Marca (Brand)
Cenário comum: você usa um atributo de produto chamado pa_brand.
add_filter( 'wc_ebit_Brand', function( $brand, $product ) {
$terms = wp_get_post_terms( $product->get_id(), 'pa_brand' );
if ( $terms && ! is_wp_error( $terms ) ) {
return $terms[0]->name;
}
return $brand;
}, 10, 2 );
Cenário alternativo: a marca está num meta field (vindo de um plugin de catálogo):
add_filter( 'wc_ebit_Brand', function( $brand, $product ) {
return get_post_meta( $product->get_id(), '_brand_name', true ) ?: $brand;
}, 10, 2 );
Fabricante (Manufacturer)
Geralmente diferente da marca — o fabricante é a empresa que produz, a marca é o nome comercial.
add_filter( 'wc_ebit_Manufacturer', function( $mfg, $product ) {
return get_post_meta( $product->get_id(), '_manufacturer', true ) ?: $mfg;
}, 10, 2 );
Se você não diferencia entre marca e fabricante, mande o mesmo valor:
add_filter( 'wc_ebit_Manufacturer', function( $mfg, $product ) {
return apply_filters( 'wc_ebit_Brand', $mfg, $product );
}, 10, 2 );
Submarca (SubBrand)
Para lojas com hierarquia de marcas (Marca → SubMarca → Linha).
add_filter( 'wc_ebit_SubBrand', function( $sub, $product ) {
return get_post_meta( $product->get_id(), '_sub_brand', true ) ?: $sub;
}, 10, 2 );
Condição do produto
Padrão é 0 (novo). Se sua loja vende usados ou recondicionados:
add_filter( 'wc_ebit_productCondition', function( $condition, $product ) {
$cat = wp_get_post_terms( $product->get_id(), 'product_cat', array( 'fields' => 'slugs' ) );
if ( in_array( 'usados', $cat, true ) ) {
return 1; // confirme o código de "usado" com o Ebit
}
return $condition;
}, 10, 2 );
Snippet completo (todos os filtros num lugar só)
Pra lojas que querem preencher tudo de uma vez a partir de um conjunto de metas:
add_filter( 'wc_ebit_Brand', fn( $b, $p ) =>
get_post_meta( $p->get_id(), '_brand', true ) ?: $b, 10, 2 );
add_filter( 'wc_ebit_Manufacturer', fn( $m, $p ) =>
get_post_meta( $p->get_id(), '_manufacturer', true ) ?: $m, 10, 2 );
add_filter( 'wc_ebit_SubBrand', fn( $s, $p ) =>
get_post_meta( $p->get_id(), '_sub_brand', true ) ?: $s, 10, 2 );
add_filter( 'wc_ebit_CategoryL5', function( $c, $p ) {
$terms = get_the_terms( $p->get_id(), 'product_cat' );
if ( ! $terms || is_wp_error( $terms ) ) return $c;
usort( $terms, fn( $a, $b ) => $b->term_id - $a->term_id );
return $terms[0]->name;
}, 10, 2 );
Próximos passos
- Filtros disponíveis — referência completa.
- Adicionar suporte a outro gateway — outro caso prático.