This snippet will allow you to add custom items to LD JSON Schema generated by WooCommerce
add_filter('woocommerce_structured_data_product_offer',function ($foo) {
if ( ! isset( $product ) ) {
global $product;
}
if ( ! is_a( $product, 'WC_Product' ) ) {
return;
}
if ( '' !== $product->get_price() ) {
$foo['itemCondition'] = 'https://schema.org/NewCondition';
$foo['description'] = $product->get_short_description().' '.$product->get_description();
}
return $foo;
});
add_filter('woocommerce_structured_data_product_offer',function ($foo) {
if ( ! isset( $product ) ) {
global $product;
}
if ( ! is_a( $product, 'WC_Product' ) ) {
return;
}
if ( '' !== $product->get_price() ) {
$foo['itemCondition'] = 'https://schema.org/NewCondition';
$foo['description'] = $product->get_short_description().' '.$product->get_description();
}
return $foo;
});
add_filter('woocommerce_structured_data_product_offer',function ($foo) { if ( ! isset( $product ) ) { global $product; } if ( ! is_a( $product, 'WC_Product' ) ) { return; } if ( '' !== $product->get_price() ) { $foo['itemCondition'] = 'https://schema.org/NewCondition'; $foo['description'] = $product->get_short_description().' '.$product->get_description(); } return $foo; });
Orignally from WC Issue 15045