• Resolved Make carlos

    (@make-carlos)


    I want to show one custom message based on cart update, for example if i have 10 items in cart and when i remove one item total is updated in block based cart

    but based on updated total i need to show one custom message but i can’t find out any method to do with block based cart.

    Is there any tutorial links or document in which woocommerce mentioned that based on which render block hook we can do this? trying since 2 days but not found anything.

    add_filter( 'render_block', 'bbloomer_woocommerce_cart_block_do_actions', 9999, 2 );

    function bbloomer_woocommerce_cart_block_do_actions( $block_content, $block ) {
    $blocks = array(
    'woocommerce/filled-cart-block',
    );
    if ( in_array( $block['blockName'], $blocks ) ) {
    ob_start();
    do_action( 'bbloomer_before_' . $block['blockName'] );
    echo $block_content;
    do_action( 'bbloomer_after_' . $block['blockName'] );
    $block_content = ob_get_contents();
    ob_end_clean();
    }
    return $block_content;
    }


    add_action( 'bloomer_before_woocommerce/filled-cart-block', 'disaplay_message');

    function disaplay_message() {
    // Get the cart total
    $cart_total = WC()->cart->cart_contents_total;
    if ($cart_total > 500) {
    echo "Custom message show";
    }
    }

    I hope support will give me document link instead of redirecting me to paid tasks.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.