Re: Removal of cart attributes

How can I effectively remove persistent cart attributes?

kwat
Tourist
8 0 6

An app (ShopSync) is adding cart attributes (mc_cid and created_at) that are eventually making their way to packing slips. I would prefer that this wasn't the case and would like to remove the attributes so that they do not show up in the Additional Details section of Shopify and get transferred to ShipStation as notes. I am having trouble with the forceful removal of these attributes as they seem to persist regardless of what I do to them. Below is the code I'm attempting to use for removal. This works for removing but on cart update, the attributes come back.

<script>
    $( document ).ready(function() {
      params = {
            type: 'POST',
            url: '/cart/update.js',
            data: 'attributes[created_at]=',
            dataType: 'json'
          };
      $.ajax(params);
      }, this);
  </script>

You can use this link for testing: https://michiganawesome.us2.list-manage.com/track/click?u=6939d72c2cb98ef05c8b83ace&id=b38dc8d39b&e=...

Replies 10 (10)

kerrieclark831
Shopify Partner
4 0 0

I am not familiar with ShopSync, but maybe there is some configuration/setting to prevent the cart attribute from being written in the first place?

 

If that isn't possible, you might check where the packing slips are printed. If you are using the Order Printer app, templates can be customized to include cart attributes like this:

 

{% for attribute in attributes %}

  {{ attribute | first }}: {{ attribute | last }}<br>

{% endfor %}

 

If that is the case, a simple template modification may suffice.

 

I hope this helps!

kwat
Tourist
8 0 6

Thanks for replying @kerrieclark831. There seems to be no configuration setting for ShopSync. We have attempted to use Order Printer but it has not been able to meet our needs as ShipStation offers better order filtering and order splitting that we use regularly. Thanks for the suggestions!

Kip_Veasey
Tourist
5 0 0

Was this ever resolved?  I am having the same issue. 

kwat
Tourist
8 0 6

I have not been able to figure out a way to remove the attributes. According to ShopSync support, it is a bug that they are looking in to but gave no timeline

DLau
Visitor
3 0 0

Hi Kwat,

 

Have you found any solution on that? That attributes suddenly popped up 2 days ago, and it is a pain to remove that in Shipstation.

 

On your very first post' code, where is it added to? 

 

Thanks

Robbie3
Excursionist
38 1 31

Do you use Mail Chimp?  I wonder if Mail Chimp is putting that info in based off of this article...

 

https://learndigitaladvertising.com/solved-why-how-to-remove-mc_cid-and-mc_eid-from-google-analytics...

a1fu00
Visitor
1 0 0

Solo tienes que pasarle el valor de atributo igual a nada = '', a mi me funciono 

data: {
    attributes: {'EXTRA': ''},
    note: note_self
},
DLau
Visitor
3 0 0

Hi A1fu00

 

Where is it added to? Thanks?

Asif_Muhammad
Visitor
2 0 0

This should work to remove cart attributes.

 Shopify.getCart(function(cart) {
                        var existingAttributes = cart.attributes;
                        console.log("Your cart", cart);
                        // Step 2: Remove the existing attribute with the old key / just assign empty value
                        var oldKey = 'package-type product-id 8600755339557 variant-no-1 sku 8157552-002';
                        if (existingAttributes[oldKey]) {
                          console.log("old key exists");
                          existingAttributes[oldKey] = '';
                        }
                       
                        // Step 3: Add the attribute with the new key
                        var newKey = 'new_attribute_key';
                        existingAttributes[newKey] = 'new_attribute_value11';
                       
                     
                        // Step 4: Update the cart attributes
                        Shopify.updateCartAttributes(existingAttributes, function(updatedCart) {
                          console.log('Cart attributes updated:', updatedCart.attributes);
                        });
                      });
alejuu
Shopify Partner
4 1 1

Where did you add this code? Is this a checkout script?