Advertisement
Aurangajeb

Add WooCommerce Orders shortcode

Jul 10th, 2021
1,263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. /* Add WooCommerce Orders shortcode */
  2. function woocommerce_orders() {
  3.     $user_id = get_current_user_id();
  4.     if ($user_id == 0) {
  5.          return do_shortcode('[woocommerce_my_account]');
  6.     }else{
  7.         ob_start();
  8.         wc_get_template( 'myaccount/my-orders.php', array(
  9.             'current_user'  => get_user_by( 'id', $user_id),
  10.             'order_count'   => $order_count
  11.          ) );
  12.         return ob_get_clean();
  13.     }
  14.  
  15. }
  16. add_shortcode('woocommerce_orders', 'woocommerce_orders');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement