Skip to content

Instantly share code, notes, and snippets.

@daveloodts
Last active March 27, 2020 09:25
Show Gist options
  • Save daveloodts/dbcabc8187facb58c847f036bcc152af to your computer and use it in GitHub Desktop.
Save daveloodts/dbcabc8187facb58c847f036bcc152af to your computer and use it in GitHub Desktop.
Display a custom text under cart item name in checkout #woocommerce #shipping
// Display a custom text under cart item name in checkout
add_filter( 'woocommerce_checkout_cart_item_quantity', 'custom_checkout_text_cart_item_name', 10, 3 );
function custom_checkout_text_cart_item_name( $item_qty, $cart_item, $cart_item_key ) {
// Here below define your shipping class slug
$shipping_class = 'be-shipping-klein';
if( $cart_item['data']->get_shipping_class() === $shipping_class ) {
$item_qty .= '<br /><div class="item-shipping-class">' . __("Gratis geleverd 2-4 werkdagen", "woocommerce") . '</div>';
}
return $item_qty;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment