Good evening,
I need to extract the shortcode for each section of "My Account" page in WooCommerce:
In have tried this code snippet:
add_shortcode('my_account_section', 'shortcode_my_account_section');
function shortcode_my_account_section($atts) {
extract(shortcode_atts(['section' => ''], $atts));
ob_start();
do_action('woocommerce_account_'.$section.'_endpoint');
return ob_get_clean();
}
With this snippet:
[my_account_section section="orders"]
It works fine but for the other section, no result. Thank you in advance.
Please use the below shortcode to render my-account sections.
[my_account_section section="orders"]
[my_account_section section="edit-address"]
[my_account_section section="edit-account"]