Remove attributes from the product title in GA
-
WP 4.9.4 – WC 3.2.6
Hello,
this plugin works with no problem
but since updating to WC 3+ I can see that in GA > E-commerce (Top Sellers)
that the product titles now include the size attributes!So, before the update it was easy to see the Top Sellers by product title
Product Title 1
Product Title 2
Product Title 3while now you see the product titles including size attributes which really makes it harder to understand your top seller in a Parent level straight away
Product Title 1 – Size 6
Product Title 1 – Size 8
Product Title 2 – Size 6
Product Title 2 – Size 10So would it be possible to show Top Sellers in GA with the product title only?
(as it used to be)A note here that I have implemented the following snippet in functions.php in order to remove attributes from the product titles in the cart / checkout, which works great, but unfortunately does not seem to prevent this from happening in GA.
/** * Removes the attribute from the product title, in the cart. */ function remove_variation_from_product_title( $title, $cart_item, $cart_item_key ) { $_product = $cart_item['data']; $product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key ); if ( $_product->is_type( 'variation' ) ) { if ( ! $product_permalink ) { return $_product->get_title(); } else { return sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_title() ); } } return $title; } add_filter( 'woocommerce_cart_item_name', 'remove_variation_from_product_title', 10, 3 ); add_filter( 'woocommerce_is_attribute_in_product_name', '__return_false' );
Any suggestions will be highly appreciated.
Thank you in advance,
Best,
Bill
- The topic ‘Remove attributes from the product title in GA’ is closed to new replies.