Last active
March 27, 2020 09:25
-
-
Save daveloodts/7cb0915942c31e71f09d0327a463603a to your computer and use it in GitHub Desktop.
Display a custom text under cart item name in cart page for specific shipping class #WooCommerce #shipping
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 a custom text under cart item name in cart page for specific shipping class | |
add_filter( 'woocommerce_cart_item_name', 'custom_text_cart_item_name', 10, 3 ); | |
function custom_text_cart_item_name( $item_name, $cart_item, $cart_item_key ) { | |
// Here below define your shipping class slug | |
$shipping_class = 'be-shipping-klein'; | |
if( is_cart() && $cart_item['data']->get_shipping_class() === $shipping_class ) { | |
$item_name .= '<br /><div class="item-shipping-class">' . __("Gratis geleverd 2-4 werkdagen", "woocommerce") . '</div>'; | |
} | |
return $item_name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment