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

[Bug]: Missing AddToCart value parameter

Open macrodesignuk opened this issue 3 years ago • 2 comments

Contact Details

[email protected]

What happened?

Facebook is reporting Issue: Missing AddToCart value parameter One or more of your AddToCart events is missing a value parameter. This may affect your ability to see return on ad spend calculations.

On checking the view-source of the product page. I see the variable res, is supposed to include res.value, but this is missing from the ajax response.

var product_info_url = 'https://www.example.com/fbe/Pixel/ProductInfoForAddToCart';

            $(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',
                    dataType: 'json',
                    success: function (res) {
                        trackAddToCart(
                            [res.id],
                            res.name,
                            res.content_category,
                            **res.value,**
                            res.event_id
                        );
                    }
                });
            });

I ran composer show -l and it shows the module has the latest version 1.4.3. I can't update the facebook sdk from 9.03 to 12.0.1 as this module required the version 9.0.3.

Magento Version

2.4.3

Plugin Version

1.4.3

Relevant log output

The returned json data from the ajax request to "/fbe/Pixel/ProductInfoForAddToCart" is as follows:

category: "Products,Shop"
event_id: "dd3df95b-b744-46d2-90b5-48e18eb3f462"
id: "4"
name: "My product name"


Its missing the value attribute.

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

macrodesignuk avatar Nov 03 '21 12:11 macrodesignuk

I am using Magento 2.4.0 and getting same issue (Missing AddToCart value parameter). Is there any solution of this issue ?

wajahatbashir avatar Jul 18 '22 12:07 wajahatbashir

the same thing we have on Magenta 2.4.2

infodeleted avatar Jul 29 '22 08:07 infodeleted