This support ticket is created vor 5 Jahre, 2 Monate. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
During troubleshooting, I noticed something which explains why you're not able to make the shortcode work on your website.
The shortcode is calling for related posts through the relationship "prodotto-prenotazione" which is between:
1. Products: hidden link
2. Orders: hidden link
This means that inside the "foreach" loop, the "$value" will hold the IDs of "Orders" posts, related to the current "Products" post.
But the "adult-number" custom field that you need for the sum calculation, is not attached to the "Orders" post type.
Please check the custom field group "Richiesta disponibilità" ( hidden link ), where this "Numero Adullti" ( adult-number ) is defined. You'll note that it is attached to post types "Preventivi, Ordini Tour, Chats, Proposte", but not to "Orders" post type.
This means that the final shortcode that you have would work for calculation of any custom field which exists with post type "Orders", but not with any field like "Numero Adullti" which doesn't exist with orders.
Assuming that the other shortcode "order-adult" is working to get the value of "wpcf-adult-number" from "Ordini tour" posts, you can update your shortcode's logic to:
Important note: As mentioned earlier, we can guide you around how Toolset related functions can be used, which in this case is "toolset_get_related_posts" and is returning the ID of related posts, but we can't perform troubleshooting around non-Toolset related custom PHP code.
For more personalized and 1-1 assistance around custom PHP code, it would be safer and efficient to hire a professional from our list of recommended contractors: https://toolset.com/contractors/