' . $_product->get_price_html() . '

'; // WPCS: XSS ok. if ( ! empty( $post->post_excerpt ) ) { ob_start(); woocommerce_template_single_excerpt(); $excerpt = ob_get_clean(); } // Add the button. $excerpt .= self::product_buttons(); } return $excerpt; } /** * Create the button to go to the product page for embedded products. * * @since 2.4.11 * @return string */ public static function product_buttons() { $_product = wc_get_product( get_the_ID() ); $buttons = array(); $button = '%s'; if ( $_product->is_type( 'simple' ) && $_product->is_purchasable() && $_product->is_in_stock() ) { $buttons[] = sprintf( $button, esc_url( add_query_arg( 'add-to-cart', get_the_ID(), wc_get_cart_url() ) ), esc_html__( 'Buy now', 'woocommerce' ) ); } $buttons[] = sprintf( $button, get_the_permalink(), esc_html__( 'Read more', 'woocommerce' ) ); return '

' . implode( ' ', $buttons ) . '

'; } /** * Prints the markup for the rating stars. * * @since 2.4.11 */ public static function get_ratings() { // Make sure we're only affecting embedded products. if ( ! self::is_embedded_product() ) { return; } $_product = wc_get_product( get_the_ID() ); if ( $_product && $_product->get_average_rating() > 0 ) { ?>
get_average_rating() ) ); ?>