• I’m adding support for this plugin into mine. I need to be able to pull the product addon label and the respective value selected by the customer so that I can display it.

    Example:

    Topping: Cheese
    Extra details: No relish

    If I try to pull the item meta data using _ywapo_meta_data that only gives the values of the created product addons.

    Example:

    Cheese
    No relish

    See this screenshot: https://pasteboard.co/vXaayhrjHUzY.png

    The product addon labels and their values are actually stored individually in the order item meta but I can’t find a helper option in your code to be able to know what product addons have been created by the admin so that I can get their labels and values for an order item.

    The data is stored very unorthodoxly and I can’t find a helper function from your code to pull and format this data. In the following screenshot you can see the addon label and data is stored but to be able to know what meta key to pull, I need to know what product addons were created by the admin and applied to the particular order: https://prnt.sc/6NRecLwEG9uH

Viewing 1 replies (of 1 total)
  • Plugin Support crodriguez1991

    (@crodriguez1991)

    Hello there,

    I hope you’re doing well :D.

    Probably you can retrieve the option from the order item meta in the following way:

    
    $meta_data = wc_get_order_item_meta( $item_id, '_ywapo_meta_data', true );
    
    if ( $meta_data && is_array( $meta_data ) ) {
        foreach ($meta_data as $index => $option) {
            foreach ($option as $key => $value) {
                if ($key && '' !== $value) {
                    $values = YITH_WAPO::get_instance()->split_addon_and_option_ids($key, $value);
    
                    $addon_id = $values['addon_id'];
                    $option_id = $values['option_id'];
    
                    $info = yith_wapo_get_option_info($addon_id, $option_id);
                }
            }
        }
    }
    

    Then on $info you will have the information related to the addons and you’ll retrieve the label and any other information you need.

    Please, try it and let me know if it can help you.

    Have a good day.

Viewing 1 replies (of 1 total)
  • The topic ‘How to get Addon labels and values meta’ is closed to new replies.