Comments (4)
I Have the same problem too. when you press the "add to cart" button, it shows the success messages and it disappears almost immediately!
from facebook-for-magento2.
I have the same problem not only success messages all messages quickly disappear.
from facebook-for-magento2.
We have the same problem, all messages are removed right after they are displayed. As far as i could see. After disabling the module the messages are displayed as normal again. How to solve this issue? I have allready tried the latest version from main branch.
from facebook-for-magento2.
I couldn't yet find out why, but if you use GET
instead of POST
in the ajax call for ProductInfoForAddToCart
, this issue is gone.
This call is done here: view/frontend/templates/pixel/add_to_cart.phtml
<?php /** @var \Facebook\BusinessExtension\Block\Pixel\AddToCart $block */ ?>
<?php if ($block->getFacebookPixelID()) { ?>
<script>
require([
'jquery'
], function ($) {
function trackAddToCart(content_ids, content_name, content_category, value, eventId) {
fbq('set', 'agent', '<?= $block->getFacebookAgentVersion() ?>', '<?= $block->getFacebookPixelID() ?>');
fbq('track', 'AddToCart', {
source: "<?= $block->getSource() ?>",
pluginVersion: "<?= $block->getPluginVersion() ?>",
content_type: "<?= $block->getContentType() ?>",
currency: "<?= $block->getCurrency() ?>",
content_ids: content_ids,
content_name: content_name,
content_category: content_category,
value: value
},
{
eventID: eventId
}
);
}
var product_info_url = '<?= $block->getProductInfoUrl() ?>';
$(document).on('ajax:addToCart', function (event, data) {
var product_sku = data.sku;
var form_key = jQuery("[name='form_key']").val();
$.ajax({
url: product_info_url,
data: {
product_sku: product_sku,
form_key: form_key
},
- type: 'post',
+ type: 'get',
dataType: 'json',
success: function (res) {
trackAddToCart(
[res.id],
res.name,
res.content_category,
res.value,
res.event_id
);
}
});
});
});
</script>
<?php $block->logEvent($block->getFacebookPixelID(), 'AddToCart') ?>
<?php } ?>
from facebook-for-magento2.
Related Issues (20)
- [Bug]: Response header name 'FacebookAds\\CrashReporter ' contains invalid characters, aborting request
- Critical | Magento commerce 2.4.4 | Facebook Business Extension compatibility issue HOT 7
- Cannot connect FB Business account HOT 5
- [Bug]: this method dont work on varnish cache (trackServerEvent on .phtml) HOT 2
- [Bug]: Magento Frontend Not loading after installing the version 1.4.5 HOT 1
- PHP8 compatibility patches for Facebook Magento 2 Extension.
- Add to cart issue
- Setup not being saved HOT 1
- [Bug]: Magento 2.4.x and PHP8.x Compatibiliy HOT 2
- [Bug]: Table name missing dynamic prefix [fix]
- Facebook Pixel (Catalog API): Not working HOT 2
- [Bug]: Front controller reached 100 router match iterations
- [Bug]: Security errors in Facebook Magento 2 extension | V1.4.6
- [Bug]: Error while update extension by composer HOT 1
- [Bug]: GDPR Not Managed
- [Bug]: InitiateCheckout and Purchase did not calculate the discounted price
- [Bug]: Showing blank screen at frontend
- Couldn't use the extension in Multiwebsite environment in Magento 2
- [Bug]: Products with special price not getting saved HOT 1
- [Bug]: Send Event add to cart
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from facebook-for-magento2.