In this code that you gave me the shipping estimate can be displayed within certain categories or by brand or tag etc. I removed it because it was not needed but now I can not display the shipping estimate within the related products. Can you help?
Thanks.
add_filter( ‘woocommerce_get_price_html’, ‘add_estimated_delivery_to_price’, 999, 2 );
function add_estimated_delivery_to_price( $price, $product ) {
/*if (is_tax(‘brand’) || is_shop() || is_product_category() || is_product_tag())*/
{ // Only in the shop and categories page
// Escludi dalla pagina del singolo prodotto
if ( is_product() ) {
return $price;
}
ob_start();
add_filter( ‘etheme_sales_booster_estimated_delivery’, ‘__return_true’ );
$estimated_delivery = \Etheme_Sales_Booster_Estimated_Delivery::get_instance();
$estimated_delivery->init( $product );
$estimated_delivery->args[ ‘in_quick_view’ ] = true;
$estimated_delivery->add_actions();
$original_tag = $estimated_delivery->args[ ‘tag’ ];
$estimated_delivery->args[ ‘tag’ ] = ‘div’;
$estimated_delivery->output();
$estimated_delivery->args[ ‘tag’ ] = $original_tag;
remove_filter( ‘etheme_sales_booster_estimated_delivery’, ‘__return_true’ );
$estimate = ob_get_clean();
$price .= $estimate;
}
return $price;
}