facebook-for-woocommerce icon indicating copy to clipboard operation
facebook-for-woocommerce copied to clipboard

Placeholder for events through Ajax is always triggered

Open engineerized opened this issue 4 years ago β€’ 1 comments

  • [X] I have confirmed this occurs in the most recent version of WordPress, WooCommerce, and Facebook for WooCommerce.
  • [X] I have confirmed this occurs when only WooCommerce and Facebook for WooCommerce are active and when using a default WordPress or WooCommerce theme.

✍️ Describe the bug

In file location facebook-for-woocommerce/facebook-commerce-pixel-event.php

<!-- %s Facebook Integration Begin -->
%s
<script>
%s
fbq( 'track', 'PageView', %s );

document.addEventListener( 'DOMContentLoaded', function() {
	jQuery && jQuery( function( $ ) {

		// insert placeholder for events injected when a product is added to the cart through Ajax
		$( document.body ).append( '**<div class=\"wc-facebook-pixel-event-placeholder\"></div>**' );
	} );
}, false );

</script>
<!-- DO NOT MODIFY -->
<!-- %s Facebook Integration end -->

##πŸšΆβ€β™€οΈ Steps to reproduce

The placeholder <div class="wc-facebook-pixel-event-placeholder"></div> is always visible in the body tag no matter if Ajax "Add to cart" button is clicked or not.

Make sure that when Ajax is used that add to cart event is working properly by fixing this bug.

βœ”οΈ Expected behavior

This placeholder <div class="wc-facebook-pixel-event-placeholder"> should only be triggered when adding product to cart via Ajax and "AddToCart" event should be triggered.

engineerized avatar May 12 '20 08:05 engineerized

Hi there @engineerized - thanks for reporting. Based on your description, I don't see an issue here - that <div> should not trigger any events, it looks like a placeholder.

If you're seeing a bug relating to this, please add more details so we can reproduce:

  • Detailed steps for how to reproduce the issue.
  • What you expected, and what you saw - i.e. details of the bug behaviour.
  • Bonus points: how this impacts your store/business, or what you are trying to do.

Thank you πŸ™‚

haszari avatar Apr 16 '21 01:04 haszari

Based on hazsari comments. I am closing this.

rawdreeg avatar Sep 07 '22 21:09 rawdreeg