From a6b006c0f1ef757f23375f7906193370337d8bd7 Mon Sep 17 00:00:00 2001 From: "Anthony G. Basile" Date: Fri, 8 Jun 2018 10:09:24 -0400 Subject: Update jetpack 6.2 --- .../classes/wp-google-analytics-universal.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-universal.php') diff --git a/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-universal.php b/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-universal.php index eb6734b3..f86edf65 100644 --- a/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-universal.php +++ b/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-universal.php @@ -248,22 +248,26 @@ class Jetpack_Google_Analytics_Universal { } /** - * Adds the product ID and SKU to the remove product link (for use by remove_from_cart above) if not present - */ + * Adds the product ID and SKU to the remove product link (for use by remove_from_cart above) if not present + * + * @param string $url Full HTML a tag of the link to remove an item from the cart. + * @param string $key Unique Key ID for a cart item. + */ public function remove_from_cart_attributes( $url, $key ) { if ( false !== strpos( $url, 'data-product_id' ) ) { return $url; } - $item = WC()->cart->get_cart_item( $key ); - $product = $item[ 'data' ]; + $item = WC()->cart->get_cart_item( $key ); + $product = $item['data']; - $new_attributes = sprintf( 'href="%s" data-product_id="%s" data-product_sku="%s"', - esc_attr( $url ), + $new_attributes = sprintf( + '" data-product_id="%1$s" data-product_sku="%2$s">', esc_attr( $product->get_id() ), esc_attr( $product->get_sku() ) - ); - $url = str_replace( 'href=', $new_attributes, $url ); + ); + + $url = str_replace( '">', $new_attributes, $url ); return $url; } -- cgit v1.2.3-65-gdbad