WooCommerce:结账时回收产品名称

Hope you guys can help.

I'm working on a WooCommerce shop that sells software-plans for 1 product. Therefor I've deactivated the cart-page and made it possible only to have 1 item in the checkout (old items are automaticly removed).

What I need, is too echo out the product name in the "cart" before the checkout fields.
E.g. "Yaaay, you selected the XXXX-plan!".

I tried to use below code from the review-order.php, but no luck.

<?php echo apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key ) . '&nbsp;'; ?>

Any ideas? Thank you in advance.

You can use 'woocommerce_before_checkout_billing_form' hook or 'woocommerce_checkout_before_order_review' hook to add your Title for product purchased in cart.

Basically

add_action('woocommerce_before_checkout_billing_form','wdm_my_custom_title',10,1);

function wdm_my_custom_title($checkout){
 // code to retrieve item title in cart . And echoing it with the custom title which we need.
}

Or

add_action('woocommerce_checkout_before_order_review','wdm_my_custom_title',10);

function wdm_my_custom_title(){
 // code to retrieve item title in cart . And echoing it with the custom title which we need.
}

Use one of the codes as per your requirement of location where the Title needs to be displayed.