Hallo,
a new special issue :)
I have created products as portfolio pages. On the first page is the “Portfolio Raster” shown -> just product image and name. On click at this product the portfolio page opens with product details and price. Now, the price should be also visible in the products that are shown in the Portfolio Raster below the product name.
Sure, i can add it manully as a text block. But is there a way to “clone” the price text block from the detail pages and show it also in the Portfolio raster? So that finally i only need to update the price in the portfolio product detail pages if price changes?
Hope this is clear enough described :)
Hey Sebastian,
Thank you for the inquiry.
Did you enable the excerpt in the portfolio grid settings? If so, you can add the following filter in the functions.php file to append the product price to the excerpt:
add_filter("avf_portfolio_grid_excerpt", function($excerpt, $entry) {
$id = $entry->ID;
if( get_post_type( $id ) == "product" ) {
$product = wc_get_product( $id );
$excerpt .= "<span class='av-portfolio-product-price'>" . $product->get_regular_price() . "</span>";
}
return $excerpt;
}, 10, 2);
Best regards,
Ismael