• Resolved Ram Gupta

    (@ram-gupta)


    Thanks for the awesome plugin. I want to retrieve fields on cart page like normal custom field. Example code :

    foreach ( WC()->cart->get_cart() as $cart_item ) {
          $deliveryDays[] = get_post_meta( $cart_item['variation_id'], 'custom_field', true);
    }

    I tried

    get_post_meta($cart_item['variation_id'], 'delivery_week', true);

    Where delivery week is the name of custom field.

    I see you have a hook when order is placed

    wc_get_order_item_meta($orderID, 'delivery_week', $single = true );

    Do we have something similar so I can get the value when looping through the cart in the cart page?

    Thanks in advance.

    • This topic was modified 1 year, 10 months ago by Ram Gupta.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author ThemeHigh

    (@themehigh)

    You can achieve your requirement using the below code.

    foreach ( WC()->cart->get_cart() as $cart_item ) {
    $wepo_options = $cart_item['thwepof_options'];
    foreach($wepo_options as $key => $value){
    if($key == 'delivery_week'){
    $deliveryDays[] = $value['value'];
    }
    }
    }

    In the above code, delivery_week is the field name.

    Thank you!

Viewing 1 replies (of 1 total)
  • The topic ‘Need values in cart page’ is closed to new replies.