Add_To_Cart::add_tracking_attributes_to_purchase_button( array $attributes, BigCommercePost_TypesProductProduct $product )

Summary

No summary available.

Parameters

$attributes

(array) (Required)

$product

(BigCommercePost_TypesProductProduct) (Required)


Return

(array)


Source

File: src/BigCommerce/Analytics/Events/Add_To_Cart.php

	public function add_tracking_attributes_to_purchase_button( $attributes, $product ) {
		return array_merge( $attributes, [
			'data-tracking-trigger' => 'ready',
			'data-tracking-event'   => 'add_to_cart',
			'data-tracking-data'    => wp_json_encode( [
				'post_id'    => $product->post_id(),
				'product_id' => $product->bc_id(),
				'name'       => get_the_title( $product->post_id() ),
			] ),
		] );
	}

User Contributed Notes

You must log in before being able to contribute a note or feedback.