{"id":36,"date":"2019-11-11T11:47:28","date_gmt":"2019-11-11T17:47:28","guid":{"rendered":"https:\/\/travisolson.net\/code\/?p=36"},"modified":"2019-11-11T11:47:28","modified_gmt":"2019-11-11T17:47:28","slug":"woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page","status":"publish","type":"post","link":"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/","title":{"rendered":"WooCommerce: Show a Link to the List of Orders from the User Profile Page"},"content":{"rendered":"<p>This will add a &#8220;Customer Orders&#8221; link on the customer\/user profile edit page.\u00a0 Handy when trying to find a full history of a customer&#8217;s orders.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\/\/ Show a link to the list of orders for a user\r\nfunction myprefix_user_orders_link(WP_User $user) {\r\n  if (!ssc_is_admin()) {\r\n    return;\r\n  }\r\n  $link = admin_url('edit.php?s&amp;post_type=shop_order&amp;_customer_user='.$user-&gt;ID);\r\n  echo '&lt;tr&gt;&lt;td colspan=\"2\"&gt;&lt;a href=\"' . $link . '\" class=\"button\"&gt;Customer Orders&lt;\/a&gt;&lt;\/td&gt;&lt;\/tr&gt;';\r\n}\r\nadd_action('personal_options', 'myprefix_user_orders_link');<\/pre>\n<p>To add the link to the Users list:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">function myprefix_user_list_send_password_reset_email_link($actions, $user) {\r\n  $link = admin_url('edit.php?s&amp;post_type=shop_order&amp;_customer_user='.$user-&gt;ID);\r\n  $actions['customer_orders'] = '&lt;a href=\"' . $link . '\"&gt;Customer Orders&lt;\/a&gt;';\r\n  return $actions;\r\n}\r\nadd_filter('user_row_actions', 'myprefix_user_list_send_password_reset_email_link', 80, 2);<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This will add a &#8220;Customer Orders&#8221; link on the customer\/user profile edit page.\u00a0 Handy when trying to find a full history of a customer&#8217;s orders. \/\/ Show a link to the list of orders for a user function myprefix_user_orders_link(WP_User $user) { if (!ssc_is_admin()) { return; } $link = admin_url(&#8216;edit.php?s&amp;post_type=shop_order&amp;_customer_user=&#8217;.$user-&gt;ID); echo &#8216;&lt;tr&gt;&lt;td colspan=&#8221;2&#8243;&gt;&lt;a href=&#8221;&#8216; . $link&#8230;  <a class=\"excerpt-read-more\" href=\"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/\" title=\"Read WooCommerce: Show a Link to the List of Orders from the User Profile Page\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,2],"tags":[],"class_list":["post-36","post","type-post","status-publish","format-standard","hentry","category-woocommerce","category-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>WooCommerce: Show a Link to the List of Orders from the User Profile Page - Travis Olson&#039;s Code Snippets<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WooCommerce: Show a Link to the List of Orders from the User Profile Page - Travis Olson&#039;s Code Snippets\" \/>\n<meta property=\"og:description\" content=\"This will add a &#8220;Customer Orders&#8221; link on the customer\/user profile edit page.\u00a0 Handy when trying to find a full history of a customer&#8217;s orders. \/\/ Show a link to the list of orders for a user function myprefix_user_orders_link(WP_User $user) { if (!ssc_is_admin()) { return; } $link = admin_url(&#039;edit.php?s&amp;post_type=shop_order&amp;_customer_user=&#039;.$user-&gt;ID); echo &#039;&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;a href=&quot;&#039; . $link... Read more &raquo;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/\" \/>\n<meta property=\"og:site_name\" content=\"Travis Olson&#039;s Code Snippets\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-11T17:47:28+00:00\" \/>\n<meta name=\"author\" content=\"Travis Olson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Travis Olson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/\"},\"author\":{\"name\":\"Travis Olson\",\"@id\":\"https:\/\/www.travisolson.net\/code\/#\/schema\/person\/0170ab5b2e7a3d88436375cc50336934\"},\"headline\":\"WooCommerce: Show a Link to the List of Orders from the User Profile Page\",\"datePublished\":\"2019-11-11T17:47:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/\"},\"wordCount\":50,\"publisher\":{\"@id\":\"https:\/\/www.travisolson.net\/code\/#\/schema\/person\/0170ab5b2e7a3d88436375cc50336934\"},\"articleSection\":[\"WooCommerce\",\"WordPress\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/\",\"url\":\"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/\",\"name\":\"WooCommerce: Show a Link to the List of Orders from the User Profile Page - Travis Olson&#039;s Code Snippets\",\"isPartOf\":{\"@id\":\"https:\/\/www.travisolson.net\/code\/#website\"},\"datePublished\":\"2019-11-11T17:47:28+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.travisolson.net\/code\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WooCommerce: Show a Link to the List of Orders from the User Profile Page\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.travisolson.net\/code\/#website\",\"url\":\"https:\/\/www.travisolson.net\/code\/\",\"name\":\"Travis Olson&#039;s Code Snippets\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.travisolson.net\/code\/#\/schema\/person\/0170ab5b2e7a3d88436375cc50336934\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.travisolson.net\/code\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.travisolson.net\/code\/#\/schema\/person\/0170ab5b2e7a3d88436375cc50336934\",\"name\":\"Travis Olson\",\"logo\":{\"@id\":\"https:\/\/www.travisolson.net\/code\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.travisolson.net\/code\/author\/travis-olson\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WooCommerce: Show a Link to the List of Orders from the User Profile Page - Travis Olson&#039;s Code Snippets","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/","og_locale":"en_US","og_type":"article","og_title":"WooCommerce: Show a Link to the List of Orders from the User Profile Page - Travis Olson&#039;s Code Snippets","og_description":"This will add a &#8220;Customer Orders&#8221; link on the customer\/user profile edit page.\u00a0 Handy when trying to find a full history of a customer&#8217;s orders. \/\/ Show a link to the list of orders for a user function myprefix_user_orders_link(WP_User $user) { if (!ssc_is_admin()) { return; } $link = admin_url('edit.php?s&amp;post_type=shop_order&amp;_customer_user='.$user-&gt;ID); echo '&lt;tr&gt;&lt;td colspan=\"2\"&gt;&lt;a href=\"' . $link... Read more &raquo;","og_url":"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/","og_site_name":"Travis Olson&#039;s Code Snippets","article_published_time":"2019-11-11T17:47:28+00:00","author":"Travis Olson","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Travis Olson","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/#article","isPartOf":{"@id":"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/"},"author":{"name":"Travis Olson","@id":"https:\/\/www.travisolson.net\/code\/#\/schema\/person\/0170ab5b2e7a3d88436375cc50336934"},"headline":"WooCommerce: Show a Link to the List of Orders from the User Profile Page","datePublished":"2019-11-11T17:47:28+00:00","mainEntityOfPage":{"@id":"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/"},"wordCount":50,"publisher":{"@id":"https:\/\/www.travisolson.net\/code\/#\/schema\/person\/0170ab5b2e7a3d88436375cc50336934"},"articleSection":["WooCommerce","WordPress"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/","url":"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/","name":"WooCommerce: Show a Link to the List of Orders from the User Profile Page - Travis Olson&#039;s Code Snippets","isPartOf":{"@id":"https:\/\/www.travisolson.net\/code\/#website"},"datePublished":"2019-11-11T17:47:28+00:00","breadcrumb":{"@id":"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.travisolson.net\/code\/woocommerce-show-a-link-to-the-list-of-orders-from-the-user-profile-page\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.travisolson.net\/code\/"},{"@type":"ListItem","position":2,"name":"WooCommerce: Show a Link to the List of Orders from the User Profile Page"}]},{"@type":"WebSite","@id":"https:\/\/www.travisolson.net\/code\/#website","url":"https:\/\/www.travisolson.net\/code\/","name":"Travis Olson&#039;s Code Snippets","description":"","publisher":{"@id":"https:\/\/www.travisolson.net\/code\/#\/schema\/person\/0170ab5b2e7a3d88436375cc50336934"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.travisolson.net\/code\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.travisolson.net\/code\/#\/schema\/person\/0170ab5b2e7a3d88436375cc50336934","name":"Travis Olson","logo":{"@id":"https:\/\/www.travisolson.net\/code\/#\/schema\/person\/image\/"},"url":"https:\/\/www.travisolson.net\/code\/author\/travis-olson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.travisolson.net\/code\/wp-json\/wp\/v2\/posts\/36","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.travisolson.net\/code\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.travisolson.net\/code\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.travisolson.net\/code\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.travisolson.net\/code\/wp-json\/wp\/v2\/comments?post=36"}],"version-history":[{"count":1,"href":"https:\/\/www.travisolson.net\/code\/wp-json\/wp\/v2\/posts\/36\/revisions"}],"predecessor-version":[{"id":37,"href":"https:\/\/www.travisolson.net\/code\/wp-json\/wp\/v2\/posts\/36\/revisions\/37"}],"wp:attachment":[{"href":"https:\/\/www.travisolson.net\/code\/wp-json\/wp\/v2\/media?parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.travisolson.net\/code\/wp-json\/wp\/v2\/categories?post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.travisolson.net\/code\/wp-json\/wp\/v2\/tags?post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}