• Resolved axelte

    (@axelte)


    Hi, first I have to say is congratulations for your plugin, it is great. I would appreciate if you could help me with this issue: I am trying to get the addons per item for an order so that I am using the following code:

    foreach ($order->get_items() as $item_id => $item_data) {
    $product_name = $item_data[‘name’];
    $item_quantity = $order->get_item_meta($item_id, ‘_qty’, true);
    $item_addons = $order->get_item_meta($item_id, ‘_zaddon_values’, true);

    $orderdetails = $item_quantity . ‘ x ‘ . $product_name . $item_addons . ‘<br>’ .”\r\n” . $orderdetails;
    }

    Unfortunately what I am getting for the addons is:

    {“1”:{“1”:{“value”:[1,2],”type”:”checkbox”}}}

    So could you tell how to properly get the addons per item, or what would be the right way to use this function?:

    $item_addons = $order->get_item_meta($item_id, ‘_zaddon_values’, true);

    Thank you! ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author bizswoop

    (@bizswoop)

    Thanks for reaching out and the feedback.

    Can you clarify and explain more the use case? And maybe even provide links or screenshots of what you are attempting to create?

    Unfortunately, we’re not exactly understanding your request on getting an add-on per item. Right now, the plugin supports mapping the Add-on to individual Products, Categories or All products. What are you defining as per item?

    Thread Starter axelte

    (@axelte)

    Hi, Thank you for your answer. I meant product instead of item. I am trying to get the sumary of an order that has been placed. So I want to get the addons ordered within that product. So I am using the code I shared before to get something like this:

    1 x Classic Burger – (Extra Cheese, Extra Bacon)
    1 x CheeseBurger – (Extra Cheese)

    Where Extra Cheese and Extra Bacon are the addons.

    Hope is easy to understand this way. Thank you!

    Plugin Author bizswoop

    (@bizswoop)

    Thanks for that additional information, but we don’t fully understand the use case. Right now, the summary you described for Product Add-ons is showing on the Cart, Checkout and Order Confirmation page after add-ons are added to the product.

    As a result, each product will include the summary of the product add-ons. Maybe we are misunderstanding the question.

    If you are doing any custom development work to change the summary already provided, we’d recommend you review the code for those 3 actions to better understand and hopefully that will help guide you.

    Thread Starter axelte

    (@axelte)

    Thank you for your answer. Yes, I would like to get something similar as I get in the email confirmation. So I would like to know which function returns the addons for each product? so that I can build a summary as I posted before. I will really appreciatte if you could help me with this. Also I am just checking the confirmation page and can see that the addons dont appear there.

    Thank you!

    Plugin Author bizswoop

    (@bizswoop)

    If you are interested in trying to develop your own custom functionality, we’d recommend you review the following file and code snippet.

    /includes/Frontend/Product.php::item_meta line 249

    This should give you a good understand on the function and it’s logic on the front-end.

    On the comment of confirmation page not showing add-ons, you might have a theme/plugin conflict or custom confirmation page rendering creating an issue. You might consider performing a theme/plugin conflict review to understand what is causing it to not display: https://www.bizswoop.com/plugin-theme-conflict-test/.

    I hope this is helpful towards your quest of developing custom functionality.

    Thread Starter axelte

    (@axelte)

    Thank you for your answer, but I am still not able to get the addons of the products. I am struggling a lot on this and it should be something simple. Could you help me with something more specific? thanks you!

    Plugin Author bizswoop

    (@bizswoop)

    Unfortunately you are asking for us to help with custom development on the plugin, this is not a support request for help or issues using the plugin.

    We’ve provided a guidance reference point of the functions being used to help support you in that development effort. We have limited support and development resources, so we can’t support custom development solutions, as this involves a lot of time and understanding in the code you are developing outside the plugin, I hope you can understand why this additional level of details with specific and comments is not something we can support on a help forum post topic at this time.

    Thread Starter axelte

    (@axelte)

    Thank you for help. Could you tell how the plugin creates the meta_key_name of the addons? What would be the meta key name of an addon called Extras? so that I can use this code? Thanks!

    $item_addons = $order->get_item_meta($item_id, meta_key_name,, true);

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to get addons per item’ is closed to new replies.