// Woocommerce - Cart page notification
add_action( 'woocommerce_before_cart_table', 'cart_page_notice' );
function cart_page_notice() {
$min_amount = 150; //This is the amount of your free shipping threshold. Change according to your free shipping settings
$current = WC()->cart->subtotal;
if ( $current < $min_amount ) {
$added_text = '
Buy ' . wc_price( $min_amount - $current ) . ' worth products more to get free shipping '; // This is the message shown on the cart page
$return_to = wc_get_page_permalink( 'shop' );
$notice = sprintf( '%s%s', $added_text, esc_url( $return_to ), 'Continue shopping
' ); // This is the text shown below the notification. Link redirects to the shop page
echo $notice;
}
}