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

Wrong hook sequence #1272

Open
2 tasks done
hogash opened this issue May 7, 2020 · 1 comment
Open
2 tasks done

Wrong hook sequence #1272

hogash opened this issue May 7, 2020 · 1 comment
Labels
needs feedback The issue/PR needs a response from any of the parties involved in the issue.

Comments

@hogash
Copy link

hogash commented May 7, 2020

🔎 Isolate the bug

  • I have confirmed this occurs in the most recent version of WordPress, WooCommerce, and Facebook for WooCommerce.
  • 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

There's a JS error in the search page fbq is undefined. After tracking down the code i noticed that inject_search_event checkes for self::isEnabled which by default is true and overridable through a hook in apply_filters method .

This method is hooked to wp_head ( https://github.com/facebookincubator/facebook-for-woocommerce/blob/master/facebook-commerce-events-tracker.php#L30 ) which is fired later than pre_get_posts (the function where search runs https://github.com/facebookincubator/facebook-for-woocommerce/blob/master/facebook-commerce-events-tracker.php#L50 ), therefore it will always return the default true.

My suggestion is to replace wp_head with init .

@haszari haszari added needs feedback The issue/PR needs a response from any of the parties involved in the issue. and removed skyverge-investigate labels Apr 16, 2021
@haszari
Copy link
Member

haszari commented Apr 16, 2021

Hi @hogash - thanks for reporting this issue. Can you provide more details please so we can track down the issue? Thank you 😃

  • Exact steps to reproduce the issue - how is your Woo site set up, what page do you see the error on, do you need to click any buttons/links or type in any fields to see the error? Feel free to include screenshots.
  • How does this issue affect your store/business. Is this breaking your site or limiting what you can do? If you add these details it helps us prioritise.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs feedback The issue/PR needs a response from any of the parties involved in the issue.
3 participants