I build a lot of sites where I am creating custom loopers.
Perhaps I have missed something but I can’t seem to pass dynamic content in the params to a custom looper.
My current use case is I have a client using WooCommerce / WooCommerce Subscriptions / LearnDash.
The client wants to have his staff access the site on the front-end and have the ability to view the students details on the front-end rather than in the WordPress admin.
I’m building the front-end page in Cornerstone with custom loopers. For the subscriptions we show all the info you would see on the “My Subscriptions” page and the single subscription in the users account but it has been adapted.
The subscriptions are listed in accordions. With the subscription id as the title of the accordion.
The issue is that within each accordion I need to get all the order info, coupon info, product info and display it.
I already have everything I want built with the ability to show everything I need. I just need a way to do this in Cornerstone.
I have the below array to create the accordion which is working fine. I can obviously build a multidimensional array but I’m trying to keep my custom loopers a bit more manageable.
I just need a way to send the subscription_id back to a new looper.
Array
(
[0] => Array
(
[subscription_id] => 14333
[subscription_status] => Scheduled
[billing_total] => R998.00 / month
)
[1] => Array
(
[subscription_id] => 14331
[subscription_status] => Scheduled
[billing_total] => R665.00 / month
)
[2] => Array
(
[subscription_num] => 14329
[subscription_status] => Scheduled
[billing_total] => R665.00 / month
)
)
Option 2
Create a multidimensional array.
This is possible but it would still be really nice to pass dynamic content in the params.
Access the data from the multidimensional array and loop through it.
Array
(
[0] => Array
(
[order_num] => 14333
[order_status] => Scheduled
[billing_total] => R998.00 / month
[order_details] => Array
(
[0] => Array
(
[order_id] => 14333
[product_id] => 299
[variation_id] => 4957
[subscription_total] => 998
[start_date_for_sub] => 2023-05-03
[course_name] => Foundations of Financial Management
)
)
[related_orders] => Array
(
[0] => Array
(
[order_num] => iQA11289
[order_date] => WC_DateTime Object
(
[utc_offset:protected] => 0
[date] => 2023-05-03 09:55:42.000000
[timezone_type] => 3
[timezone] => Africa/Johannesburg
)
[order_total] => 99.00
[order_status] => completed
)
)
)
[1] => Array
(
[order_num] => 14331
[order_status] => Scheduled
[billing_total] => R665.00 / month
[order_details] => Array
(
[0] => Array
(
[order_id] => 14331
[product_id] => 296
[variation_id] => 4982
[subscription_total] => 665
[start_date_for_sub] => 2023-05-03
[course_name] => Bookkeeping
)
)
[related_orders] => Array
(
[0] => Array
(
[order_num] => iQA11289
[order_date] => WC_DateTime Object
(
[utc_offset:protected] => 0
[date] => 2023-05-03 09:55:42.000000
[timezone_type] => 3
[timezone] => Africa/Johannesburg
)
[order_total] => 99.00
[order_status] => completed
)
[1] => Array
(
[order_num] => iQA11288
[order_date] => WC_DateTime Object
(
[utc_offset:protected] => 0
[date] => 2023-05-03 09:33:25.000000
[timezone_type] => 3
[timezone] => Africa/Johannesburg
)
[order_total] => 99.00
[order_status] => completed
)
)
)
)