Support » Plugin: CoCart - Headless ecommerce » How to get product custom data in admin order.

  • Resolved thedareback

    (@thedareback)


    Hello, please where I find custom data, which were attached with the product and sent to the cart?

    {
        "id": "11",
        "quantity": "1",
         "item_data": {
          "engraved_name": "Sébastien Dumont",
          "engraved_size": "Medium"
        }
      }

    After ordering, I cannot find this data in the admin. Where can I find them please?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Sébastien Dumont

    (@sebd86)

    Need exact steps to reproduce. Thank you.

    Thread Starter thedareback

    (@thedareback)

    Thanks for reply.

    I have native woocommerce site, but I need to write a react configurator that will react to user inputs. After filling in all the necessary inputs, I wanted to send this data together with the product to the cart. That’s why I thought that it would be good to use your custom data for this particular case. Subsequently, I will simply place an order and expect to see this data somewhere. (Based on this data, I produce personalized products).

    The problem is that I can’t see this data anywhere. I don’t see them in the database, I don’t see them in the order. Where is this data stored please?`

    Thread Starter thedareback

    (@thedareback)

    Or to simplify it.

    1. I want to create a product, e.g. gold bracelet with product ID 32.
    2. There will be no add to cart button on the product page, but Configure It instead.
    3. After clicking the Configure button, the user will be redirected to the React page, where he can choose the exact shape of the bracelet, select the font for engraving, enter the text for engraving.
    4. After confirming the configuration, a function will be called which, with the help of cocart, will add the product with ID 32 to the cart.
    // However, here I would like to pass the bracelet shape, engraving font and engraving text. I would like to see this data in the order with the product so that I can instruct production based on the customer’s preference.

    Plugin Author Sébastien Dumont

    (@sebd86)

    Hey @thedareback

    To give you an example on how to convert a cart to an order. Check out this code example. Any cart item data that is applied at the time the item is added to the cart will be applied to the order if you do it this way.

    Hope it helps.

    Thread Starter thedareback

    (@thedareback)

    Hello @sebd86

    please, is there any method to which I would pull out this custom data specifically?

    I mean something like this:

    
    foreach ( $order->get_items() as $item_id => $item ) {
       $custom_data = $item->get_custom_data();
    }
    

    Thanks

    • This reply was modified 2 months, 3 weeks ago by thedareback.
    • This reply was modified 2 months, 3 weeks ago by thedareback.
    • This reply was modified 2 months, 3 weeks ago by thedareback.
    • This reply was modified 2 months, 3 weeks ago by thedareback.
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.