I have an issue when i remove product from the cart and the page refresh to the empty cart page. I use this inside my functions.php file to modify the empty cart page :
add_action( 'woocommerce_cart_is_empty', 'custom_empty_cart_message', 10 );
function custom_empty_cart_message() {
$html = '<h1 class="woocommerce-cart-title">Cart</h1>';
$html .= '<div class="cart-empty"><p class="cart-empty">';
$html .= '<p class="cart-empty cart-empty_text">Your cart is currently empty.</p>';
$html .= '<img fetchpriority="high" decoding="async" width="540" height="540" src="https://myurl.com/wp-content/uploads/2024/04/empty_bento.jpeg" alt="empty_bento" class="empty_bento" sizes="(max-width: 740px) 100vw, 740px">';
echo $html . '</p></div>';
echo do_shortcode( '[woo_product_slider id="2994"]' );
}
The first part is working but then the shortcode slider is not rendered, i have an infinite loading wheel.
If i manually refresh the page a second time, everything loads correctly and works.
How can i successfully render the shortcode on first page reload ?