facebook-for-magento2
facebook-for-magento2 copied to clipboard
AddToCart event is not fired when it's not default website
Precondition
- A Magento installation has multiple websites
- None Access-Control-Allow-Origin is set up for website
- What customer visits is not the default website
Reproduce Steps
-
- Visit any product page
-
- Press Add to Cart button
Expect
- AddToCart event is fired to Facebook
Actual
- None event is fired to Facebook
- The following error message presents in Browser Developer Tool > Console
XMLHTTPRequest at 'https://XXX/fbe/Pixel/ProductInfoForAddToCart' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Investigation The issue is at \Facebook\BusinessExtension\Helper\FBEHelper::getStore() function. It always return default store view instead of what customer is visiting.
Hi @qlhu, we are currently having the same issue. Did you receive any help or adivce? Or was there anything, that you could do to solve the issue?
Any help would be highly appreciated!
Thanks, Patrick
Related to #85
Anything new here?