Last active
February 15, 2023 06:17
-
-
Save nrlsyhmina/13bc18bd765c9224cdac1db7a4be1ddc to your computer and use it in GitHub Desktop.
WooCommerce - Add text after cart table for selected roles
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
/*@ Display text at cart page based on selected roles*/ | |
add_action('woocommerce_before_cart_collaterals', 'tf_cart_page_custom_text'); | |
function tf_cart_page_custom_text() { | |
if (current_user_can('subscriber')) { | |
$message = '<div class="cart-custom-message">'; | |
$message.= '<h2>GET FREE SHIPPING</h2>'; | |
$message.= | |
'<p align="justify">Use freeshipping code to get Free Shipping</p>'; | |
$message.= '</div>'; | |
echo $message; | |
} else if (current_user_can('customer')) { | |
$message = '<div class="cart-custom-message">'; | |
$message.= '<h2>FREE SHIPPING</h2>'; | |
$message.= | |
'<p align="justify">Apply freeshipping code to get Free Shipping</p>'; | |
$message.= '</div>'; | |
echo $message; | |
} else { | |
$message = '<div class="cart-custom-message">'; | |
$message.= '<h2>JOIN MEMBERSHIP</h2>'; | |
$message.= '<p align="justify">Join Member to Get Discount Voucher</p>'; | |
$message.= '</div>'; | |
echo $message; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment