{"id":38,"date":"2019-11-11T11:53:28","date_gmt":"2019-11-11T17:53:28","guid":{"rendered":"https:\/\/travisolson.net\/code\/?p=38"},"modified":"2019-11-11T11:53:28","modified_gmt":"2019-11-11T17:53:28","slug":"woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name","status":"publish","type":"post","link":"https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/","title":{"rendered":"WooCommerce: Strip the Product Page Link From the Cart Items, Showing Only Product Name"},"content":{"rendered":"<p>If you want to remove links from the product names in the WooCommerce cart you can use this simple filter. It returns the product name, without anything else appended.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">function myprefix_woocommerce_cart_item_name($name, $cart_item, $cart_item_key) {\r\n  $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );\r\n  return $_product-&gt;get_name();\r\n}\r\nadd_filter('woocommerce_cart_item_name', 'myprefix_woocommerce_cart_item_name', 10, 3);<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to remove links from the product names in the WooCommerce cart you can use this simple filter. It returns the product name, without anything else appended. function myprefix_woocommerce_cart_item_name($name, $cart_item, $cart_item_key) { $_product = apply_filters( &#8216;woocommerce_cart_item_product&#8217;, $cart_item[&#8216;data&#8217;], $cart_item, $cart_item_key ); return $_product-&gt;get_name(); } add_filter(&#8216;woocommerce_cart_item_name&#8217;, &#8216;myprefix_woocommerce_cart_item_name&#8217;, 10, 3); &nbsp;<\/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-38","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: Strip the Product Page Link From the Cart Items, Showing Only Product Name - 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-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WooCommerce: Strip the Product Page Link From the Cart Items, Showing Only Product Name - Travis Olson&#039;s Code Snippets\" \/>\n<meta property=\"og:description\" content=\"If you want to remove links from the product names in the WooCommerce cart you can use this simple filter. It returns the product name, without anything else appended. function myprefix_woocommerce_cart_item_name($name, $cart_item, $cart_item_key) { $_product = apply_filters( &#039;woocommerce_cart_item_product&#039;, $cart_item[&#039;data&#039;], $cart_item, $cart_item_key ); return $_product-&gt;get_name(); } add_filter(&#039;woocommerce_cart_item_name&#039;, &#039;myprefix_woocommerce_cart_item_name&#039;, 10, 3); &nbsp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/\" \/>\n<meta property=\"og:site_name\" content=\"Travis Olson&#039;s Code Snippets\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-11T17:53: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<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/\"},\"author\":{\"name\":\"Travis Olson\",\"@id\":\"https:\/\/www.travisolson.net\/code\/#\/schema\/person\/0170ab5b2e7a3d88436375cc50336934\"},\"headline\":\"WooCommerce: Strip the Product Page Link From the Cart Items, Showing Only Product Name\",\"datePublished\":\"2019-11-11T17:53:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/\"},\"wordCount\":44,\"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-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/\",\"url\":\"https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/\",\"name\":\"WooCommerce: Strip the Product Page Link From the Cart Items, Showing Only Product Name - Travis Olson&#039;s Code Snippets\",\"isPartOf\":{\"@id\":\"https:\/\/www.travisolson.net\/code\/#website\"},\"datePublished\":\"2019-11-11T17:53:28+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.travisolson.net\/code\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WooCommerce: Strip the Product Page Link From the Cart Items, Showing Only Product Name\"}]},{\"@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: Strip the Product Page Link From the Cart Items, Showing Only Product Name - 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-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/","og_locale":"en_US","og_type":"article","og_title":"WooCommerce: Strip the Product Page Link From the Cart Items, Showing Only Product Name - Travis Olson&#039;s Code Snippets","og_description":"If you want to remove links from the product names in the WooCommerce cart you can use this simple filter. It returns the product name, without anything else appended. function myprefix_woocommerce_cart_item_name($name, $cart_item, $cart_item_key) { $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); return $_product-&gt;get_name(); } add_filter('woocommerce_cart_item_name', 'myprefix_woocommerce_cart_item_name', 10, 3); &nbsp;","og_url":"https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/","og_site_name":"Travis Olson&#039;s Code Snippets","article_published_time":"2019-11-11T17:53:28+00:00","author":"Travis Olson","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Travis Olson"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/#article","isPartOf":{"@id":"https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/"},"author":{"name":"Travis Olson","@id":"https:\/\/www.travisolson.net\/code\/#\/schema\/person\/0170ab5b2e7a3d88436375cc50336934"},"headline":"WooCommerce: Strip the Product Page Link From the Cart Items, Showing Only Product Name","datePublished":"2019-11-11T17:53:28+00:00","mainEntityOfPage":{"@id":"https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/"},"wordCount":44,"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-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/","url":"https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/","name":"WooCommerce: Strip the Product Page Link From the Cart Items, Showing Only Product Name - Travis Olson&#039;s Code Snippets","isPartOf":{"@id":"https:\/\/www.travisolson.net\/code\/#website"},"datePublished":"2019-11-11T17:53:28+00:00","breadcrumb":{"@id":"https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.travisolson.net\/code\/woocommerce-strip-the-product-page-link-from-the-cart-items-showing-only-product-name\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.travisolson.net\/code\/"},{"@type":"ListItem","position":2,"name":"WooCommerce: Strip the Product Page Link From the Cart Items, Showing Only Product Name"}]},{"@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\/38","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=38"}],"version-history":[{"count":1,"href":"https:\/\/www.travisolson.net\/code\/wp-json\/wp\/v2\/posts\/38\/revisions"}],"predecessor-version":[{"id":39,"href":"https:\/\/www.travisolson.net\/code\/wp-json\/wp\/v2\/posts\/38\/revisions\/39"}],"wp:attachment":[{"href":"https:\/\/www.travisolson.net\/code\/wp-json\/wp\/v2\/media?parent=38"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.travisolson.net\/code\/wp-json\/wp\/v2\/categories?post=38"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.travisolson.net\/code\/wp-json\/wp\/v2\/tags?post=38"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}