Created
May 31, 2016 11:02
-
-
Save kreamweb/ee7d2b5e62e81749824120e632f67cfa to your computer and use it in GitHub Desktop.
add cart messages on mini cart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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 ); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment