Woocommerce: Display Product Variation Description on Cart page

前端 未结 3 965
猫巷女王i
猫巷女王i 2021-02-15 10:25

I\'m trying to display my product variation description in my Cart. I have tried inserting this code in the cart.php template:

3条回答
  •  名媛妹妹
    2021-02-15 11:18

    You can get it via global variable $woocommerce also-

    global $woocommerce;
    $cart_data = $woocommerce->cart->get_cart();
    foreach ($cart_data as $value) {
        $_product = $value['data'];
        if( $_product->is_type( 'variation' ) ){
            echo $_product->id . '
    '; } }

    I already check it.

提交回复
热议问题