0

Update a product price with 'Order Updated' event

Hello everyone !

In our business, onstreet parking session, the user has the possibility to extend an ongoing session.

As an ie :

- The user starts a session of 1 hour for 1€

- If he does nothing, the session will stop after 1 hour by itself

- If he needs, the user can extend the session during this 1 hour, for ie for 2 hours = 2€

We send an Order Completed when he first launched a session

"event": "Order Completed",
  "properties": {
    "currency": "EUR",
    "orderId": "513737",
    "products": [
      {
        "brand": "OPnGO test",
        "category": "",
        "id": "9576",
        "name": "OPnGO test name",
        "price": 1,
        "productId": "9576",
        "quantity": 1,
        "sku": "9576",
        "variant": "onstreet"
      }
    ],
    "revenue": 1
  },

We want to send an Order Updated when he extends the session. But can we update a product.price ? For ie :

"event": "Order Updated",
  "properties": {
    "currency": "EUR",
    "orderId": "513737",
    "products": [
      {
        "brand": "OPnGO test",
        "category": "",
        "id": "9576",
        "name": "OPnGO test name",
        "price": 2,
        "productId": "9576",
        "quantity": 1,
        "sku": "9576",
        "variant": "onstreet"
      }
    ],
    "revenue": 2
  },

The quantity stays as 1 on every call.

Thanks for your help !

Antoine

4replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Antoine,

    Are you trying to update the order in a particular tool?

    Best,

    Xavier

    Reply Upvote
  • Hi Xavier,

    Our main objective is to update the order in Google Analytics, but it can also be useful for an accurate view of the orders in Amplitude.

    Antoine

    Reply Upvote
  • Hi Antoine,

    Unfortuantely, you can't directly update an order in Google Analytics using Segment's 'Order Completed' event. To get around this you will need to send 2 'Order Completed' events; one to negate the previous order, another to add new values:

    https://support.google.com/analytics/answer/1037443?hl=en 

    1) Complete initial order
     

    analytics.track('Order Completed', {
      order_id: 'order10',
      affiliation: 'Google Store',
      total: 100,
      currency: 'USD',
      products: [
        {
          product_id: '1222',
          name: 'test_prod_10',
          price: 100,
          quantity: 1
        }
      ]
    });
    

    2) Reverse previous order by using negative total and quantity properties:
     

    analytics.track('Order Completed', {
      order_id: 'order10',
      affiliation: 'Google Store',
      total: -100,
      currency: 'USD',
      products: [
        {
          product_id: '1222',
          name: 'test_prod_10',
          price: 100,
          quantity: -1
        }
      ]
    });
    

    3) Send a new 'Order Completed' event with the verified transaction amount:

    analytics.track('Order Completed', {
      order_id: 'order10',
      affiliation: 'Google Store',
      total: 50,
      currency: 'USD',
      products: [
        {
          product_id: '1222',
          name: 'test_prod_10',
          price: 50,
          quantity: 1
        }
      ]
    });
    

    4) Result in Google Analytics 'Sales Performance' Report:

    Let me know if you have any questions about this!

    Reply Upvote
  • Understood ! Thanks for the answer, we'll impletement a double sending of Order Completed

    Reply Upvote
reply to topic