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

Related Customer Events missing barcode in web-pixels-api #2238

Open
vpawebmaster opened this issue Aug 6, 2024 · 1 comment
Open

Related Customer Events missing barcode in web-pixels-api #2238

vpawebmaster opened this issue Aug 6, 2024 · 1 comment
Labels
bug Something isn't working Web Pixel

Comments

@vpawebmaster
Copy link

vpawebmaster commented Aug 6, 2024

Please list the package(s) involved in the issue, and include the version you are using

With the change to checkout extensions, the only way to add pixels is through the web-pixels-api (Customer Events) but we have found some limitations.

Describe the bug

We are currently trying to add javascript code that requires the use of the products barcode property. The problem is the web-pixels-api does not expose the property "barcode" only SKU. See https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed

Steps to reproduce the behavior:


analytics.subscribe("checkout_completed", (event) => {
  let date = new Date();

    date.setTime(date.getTime() + (86400 * 1000));
    const datestring = date.toISOString().slice(0, 19).replace('T', ' ');

    let barcodes = [];
    const lineItems = event.data?.checkout?.lineItems;
    const lilen = lineItems.length;
  
    for(let i = 0; i < lilen; i++){

        barcodes.push({"gtin": lineItems[i].variant.barcode}
   
    }


    window.gapi.load('surveyoptin', function() {
        window.gapi.surveyoptin.render(
            {
                "merchant_id": 123456789,
                "order_id": event.data?.checkout?.order?.id,
                "email": event.data?.checkout?.email,
                "delivery_country": event.data?.checkout?.shippingAddress?.countryCode,
                "estimated_delivery_date": datestring.split(' ')[0],

                "products": barcodes
    });
    }); 

Expected behavior

lineItems[i].variant.barcode should exist.

@vpawebmaster vpawebmaster added the bug Something isn't working label Aug 6, 2024
@vpawebmaster
Copy link
Author

Just wondering if this is on anyone's radar. We are still held back from using the new features due to the issue above.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Web Pixel
Projects
None yet
Development

No branches or pull requests

2 participants