Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

162
Visualizações
Function change value google tag manager

I have created a variable {{dlv-cart}} in google tag manager from datalayer, which gives a value (type array) example:

[
  {
    id: "14",
    code: "P00006-2",
    title: "Name Product 01",
    quantity: 2,
    option: {id: "85"},
    price: {withVat: 138, withoutVat: 115, vat: 23, vatRate: 20}
  },
  {
    id: "16",
    code: "P00004",
    title: "Name Product 02",
    quantity: 1,
    option: null,
    price: {withVat: 63.59, withoutVat: 52.99, vat: 10.6, vatRate: 20}
  },
  {
    id: "17",
    code: "P00003-1",
    title: "Name Product 03",
    quantity: 1,
    option: {id: "61"},
    price: {withVat: 16, withoutVat: 13.33, vat: 2.67, vatRate: 20}
  }
]

1.I need function to combine values with "_" "id" and "option.id" = "id_option.id" ...if "option" is null, then just "id") 2. I need to pull value price.WithVat

and get the result:

[
  {
    id: "14_85",
    title: "Name Product 01",
    quantity: 2,
    price: 138
  },
  {
    id: "16",
    title: "Name Product 02",
    quantity: 1,
    price: 63.59
  },
  {
    id: "17_61",
    title: "Name Product 03",
    quantity: 1,
    price: 16
  }
]

Thank you.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda