WC_Embed::the_excerpt( string $excerpt )
Create the excerpt for embedded products – we want to add the buy button to it.
Description Description
Parameters Parameters
- $excerpt
-
(Required) Embed short description.
Return Return
(string)
Source Source
File: includes/class-wc-embed.php
public static function the_excerpt( $excerpt ) {
global $post;
// Get product.
$_product = wc_get_product( get_the_ID() );
// Make sure we're only affecting embedded products.
if ( self::is_embedded_product() ) {
echo '<p><span class="wc-embed-price">' . $_product->get_price_html() . '</span></p>'; // 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;
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.4.11 | Introduced. |