This repository was archived by the owner on Apr 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
Message Success on Product Page times out too quickly when adding to cart. #59
Comments
I Have the same problem too. when you press the "add to cart" button, it shows the success messages and it disappears almost immediately! |
I have the same problem not only success messages all messages quickly disappear. |
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. |
I couldn't yet find out why, but if you use This call is done here: <?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 } ?> |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
We encountered this problem yesterday on our site. We ruled it out to this extension being the culprit. What happens is, that when a user clicks a product and goes to its details page, if they click "add to cart", the "success" message that usually appears at the bottom (for us) of the page, flickers then disappears essentially not letting the customer know that the product was added.
We also would like to note, this "flicker" does not occur anywhere else except for when we add to cart from the product details page. We would also like to point out, that if we do not run the setup to hook up our facebook page and pixel. The messages appear as they should.
Here are our steps:
The text was updated successfully, but these errors were encountered: