diff --git a/modules/search/instant-search/components/search-result-product.jsx b/modules/search/instant-search/components/search-result-product.jsx index 9937a9b962e6a..a745d9ecacf9a 100644 --- a/modules/search/instant-search/components/search-result-product.jsx +++ b/modules/search/instant-search/components/search-result-product.jsx @@ -4,12 +4,65 @@ * External dependencies */ import { h, Component } from 'preact'; +import strip from 'strip'; + +/** + * Internal dependencies + */ +import SearchResultComments from './search-result-comments'; class SearchResultProduct extends Component { render() { + //console.log( this.props.result ); + const { result_type, fields, highlight } = this.props.result; + if ( result_type !== 'post' ) { + return null; + } + return (
-

product!

+

+ +

+ { fields[ 'img.url.raw' ] && ( + { + ) } +
+
+ + { fields[ 'meta._wc_average_rating.value.raw' ] && + strip( fields[ 'meta._wc_average_rating.value.raw' ] ).split( ' ' )[ 0 ] } + + + { fields[ 'meta._wc_rating_count' ] && + strip( fields[ 'meta._wc_average_rating.value.raw' ] ).split( ' ' )[ 0 ] } + +
+ +
+ + { strip( fields[ 'wc.price' ] ).split( ' ' )[ 0 ] } + +
+ + { highlight.comments && }
); }