Advertisement
DeniGD

Woo_orders

Mar 25th, 2024 (edited)
735
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. function woo_order_history( $atts ) {
  2. extract( shortcode_atts( array(
  3.     'order_count' => -1
  4. ), $atts ) );
  5.  
  6. ob_start();
  7. $customer_orders = wc_get_orders( apply_filters( 'woocommerce_my_account_my_orders_query', array(
  8.     'customer' => get_current_user_id(),
  9.     'page'     => $current_page,
  10.     'paginate' => true,
  11. ) ) );
  12. wc_get_template(
  13.     'myaccount/orders.php',
  14.     array(
  15.         'current_page'    => absint( $current_page ),
  16.         'customer_orders' => $customer_orders,
  17.         'has_orders'      => 0 < $customer_orders->total,
  18.     )
  19. );
  20. return ob_get_clean();
  21. }
  22. add_shortcode('woocommerce_history', 'woo_order_history');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement