function bundle_order_meta_handler($item_id, $values, $cart_item_key)
{
    global $woocommerce;
    if (WC()->session->__isset($cart_item_key . '_cart_size')) {
        $size = trim(WC()->session->get($cart_item_key . '_cart_size'));
        wc_add_order_item_meta($item_id, "Size ", $size);
    }
    if (WC()->session->__isset($cart_item_key . '_product_id')) {
        $product_id = trim(WC()->session->get($cart_item_key . '_product_id'));
        $product_type = trim(WC()->session->get($cart_item_key . '_product_type'));
        if ($product_type == 'bundle') {
            $compound_id = $product_id;
            $total_size = trim(WC()->session->get($cart_item_key . '_cart_size'));
            $herbs = get_bundle_info($compound_id, $total_size);
            wc_add_order_item_meta($item_id, "Herbs ", $herbs);
        }
        //wc_add_order_item_meta( $item_id, "Size ", $size );
    }
}
Beispiel #2
0
        ?>
					</td>

					<td class="product-name">
						<?php 
        if (!$_product->is_visible()) {
            echo apply_filters('woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key) . '&nbsp;';
        } else {
            echo apply_filters('woocommerce_cart_item_name', sprintf('<a href="%s">%s </a>', $_product->get_permalink($cart_item), $_product->get_title()), $cart_item, $cart_item_key);
        }
        // Meta data
        echo WC()->cart->get_item_data($cart_item);
        if ($_product->product_type == 'bundle') {
            $compound_id = $_product->id;
            $total_size = trim(WC()->session->get($cart_item_key . '_cart_size'));
            echo get_bundle_info($compound_id, $total_size);
        }
    }
    // Backorder notification
    if ($_product->backorders_require_notification() && $_product->is_on_backorder($cart_item['quantity'])) {
        echo '<p class="backorder_notification">' . __('Available on backorder', 'woocommerce') . '</p>';
    }
    ?>
					</td>

					<td class="product-price">
						<?php 
    // if($_product->product_type=='bundle') {
    // echo "$".number_format($cart_item['cart_price'],2);
    // } else {
    echo apply_filters('woocommerce_cart_item_price', WC()->cart->get_product_price($_product), $cart_item, $cart_item_key);