Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use get_title() for content_name to match catalog name. #2781

Merged
merged 3 commits into from
Aug 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions facebook-commerce-events-tracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ public function inject_view_content_event() {
$event_data = array(
'event_name' => 'ViewContent',
'custom_data' => array(
'content_name' => $product->get_title(),
'content_name' => \WC_Facebookcommerce_Utils::clean_string( $product->get_title() ),
'content_ids' => wp_json_encode( \WC_Facebookcommerce_Utils::get_fb_content_ids( $product ) ),
'content_type' => $content_type,
'contents' => wp_json_encode(
Expand Down Expand Up @@ -583,7 +583,7 @@ public function inject_add_to_cart_event( $cart_item_key, $product_id, $quantity
'event_name' => 'AddToCart',
'custom_data' => array(
'content_ids' => wp_json_encode( \WC_Facebookcommerce_Utils::get_fb_content_ids( $product ) ),
'content_name' => $product->get_name(),
'content_name' => \WC_Facebookcommerce_Utils::clean_string( $product->get_title() ),
'content_type' => 'product',
'contents' => wp_json_encode(
array(
Expand Down Expand Up @@ -655,7 +655,7 @@ public function add_add_to_cart_event_fragment( $fragments ) {

$params = array(
'content_ids' => wp_json_encode( \WC_Facebookcommerce_Utils::get_fb_content_ids( $product ) ),
'content_name' => $product->get_name(),
'content_name' => \WC_Facebookcommerce_Utils::clean_string( $product->get_title() ),
'content_type' => 'product',
'contents' => wp_json_encode(
array(
Expand Down Expand Up @@ -846,7 +846,7 @@ public function inject_purchase_event( $order_id ) {

if ( $product ) {
$product_ids[] = \WC_Facebookcommerce_Utils::get_fb_content_ids( $product );
$product_names[] = $product->get_name();
$product_names[] = \WC_Facebookcommerce_Utils::clean_string( $product->get_title() );

if ( 'product_group' !== $content_type && $product->is_type( 'variable' ) ) {
$content_type = 'product_group';
Expand Down Expand Up @@ -1061,7 +1061,7 @@ private function get_cart_content_names() {

if ( isset( $item['data'] ) && $item['data'] instanceof \WC_Product ) {

$product_names[] = $item['data']->get_name();
$product_names[] = \WC_Facebookcommerce_Utils::clean_string( $item['data']->get_title() );
}
}
}
Expand Down
Loading