add cart messages on mini cart
<?php
if( class_exists( 'YWCM_Cart_Message' ) && get_option( 'ywcm_show_in_cart' ) == 'yes' ){
add_action('woocommerce_before_mini_cart', 'print_cart_messages' );
function print_cart_messages(){
$messages = YWCM_Cart_Message()->get_messages();
global $YWCM_Instance;
foreach ( $messages as $message ) {
$message_type = get_post_meta( $message->ID, '_ywcm_message_type', true );
$layout = ( get_post_meta( $message->ID, '_ywcm_message_layout', true ) !== '' ) ? get_post_meta( $message->ID, '_ywcm_message_layout', true ) : 'layout';
$args = ( method_exists( $YWCM_Instance, 'get_' . $message_type . '_args' ) ) ? $YWCM_Instance->{'get_' . $message_type . '_args'}( $message ) : false;
$page = get_post_meta( $message->ID, '_ywcm_message_pages', true );
if ( $args && in_array('cart', $page) ) {
yit_plugin_get_template( YITH_YWCM_DIR, '/layouts/' . $layout . '.php', $args );
}
}
}
}