Update line item's sellable title for order

Hello there,
I faced with one another question.
So, right now I do have order with one sellable for example.
Right now sellable contains a title, I would like to remove it, those I’m sending following request.

Veeqo::Order.update(11563729,{order: {line_items_attributes: [{sellable_id: 13490718, title: 'aoe'}]}}.merge(connection: User.last.veeqo_connection))

But it is not really changed at all.

It would be great if you give me an example of request I should send.

Thanx a lot :slight_smile:

Hey,

If you’re sending that as a PUT request to the /orders end point it should update the line_items_attribute - title to ‘aoe’. Is it not doing this?

That being said, we don’t use the ‘title’ field normally so it may be the case that the API does not let you PUT (update) the title.

Can you explain a bit more about why you were using that field?

Thanks,

Sure
Aoe was example one, at real I want to set it to empty field.
I have the following reason.
I’ve uploaded product and assigned to each sellable title, so in order I have product title and sellable title displayed.
Now I would like to remove sellable title, 'cos now it’s like duplication.
I’ve thought that I can do it on /products endpoint, but seems it does not change order’s line items.

I might have to come back to this tomorrow.

Why is this causing a problem? Is it possible to high the unnecessary field?
If you send an empty title when updating the order, it will only update the title for that order.

If you update the overall sellable, you should do this thorough the /products endpoint. If that isn’t working I can investigate further tomorrow.

Thanks a lot, Okay, so I’ll wait for you response

Please can you answer the the questions in my previous comment. :slight_smile:

Sure, give me few minutes :slight_smile:

So what I do have here:
For example I have a product with sellables


I’ve uploaded it and added to each sellable title, but now I want to remove it.
So I have orders in such format:

And I’m not really happy with it, I want to make them look like this order

So I’ve done following thing, removed title for sellables by setting empty title.

But the order is not changed :frowning:
20 AM

So I thought I need also update line_item_attributes for order,
So for that particular order I’ve done following request

Veeqo::Order.update(11586117, {order: {line_items_attributes: [{sellable_id: 13490717, title: ''}]}}.merge(connection: User.last.veeqo_connection))

But the order title is pretty same it was.
35 PM

Currently Investigating

Problem identified.
Working on a fix.

Sounds optimistic :slight_smile:
Just ping me when you’re done :wink:

In order to update the product variant title you need to send a PUT request to /products/:id in the following format:

{
  "product": {
    "title": "Golden Retriever Dog - Title",
    "description": "Golden Retriever Dog - Description",
    "notes": "Golden Retriever Dog - Notes",
    "product_variants_attributes": [
      {
        "id": 14144702,
        "title": "Dog - ProdVariantTitle",
        "sku_code": "g-dog-1",
        "cost_price": "100",
        "price": "150"
      },
      {
        "id": 14144703,
        "sku_code": "g-dog-2",
        "title": "Puppy - ProdVariantTitle"
      }
    ]
  }
}

This is now working for me so let me know if you have any luck!

Phil, Sure it is working as expected,
In my previous method you can find following phrase: ‘So I’ve done following thing, removed title for sellables by setting empty title.’

But still, in order titles for sellables are not changed. That’s what I’m asking about.

So, I’ve done following thing:

prepare = []
[6] pry(main)> ids = product[:sellables].pluck(:id)
=> [13490719, 13490718, 13490720, 13490717]
[7] pry(main)> ids.each do |id|
[7] pry(main)*   prepare << {id: id, title: ''}
[7] pry(main)* end
=> [13490719, 13490718, 13490720, 13490717]
[8] pry(main)> prepare
=> [{:id=>13490719, :title=>""}, {:id=>13490718, :title=>""}, {:id=>13490720, :title=>""}, {:id=>13490717, :title=>""}]
[9] pry(main)> Veeqo::Product.update(8027317, {product: {product_variants_attributes: prepare}}.merge(connection: User.last.veeqo_connection))

That request updated all titles to ‘’, just making them empty.
In my order I do see following thing


Title here is Diesel Jacket - Diesel Jacket
I want to remove that duplication in title for already existing orders(So I want to have just Diesel Jacket left. Duplication is because I’ve assigned title for sellable, now I want to remove it).
But still, if I open that product, there is no title assigned for sellables. It seems that order has it’s own cached products inside, that are without connection to their originals that are in products tab.

So what exactly I want to do:
I’ve had this picture


Now I want this

Making sellable title disappearing from that field under order number, and everywhere else.
If you have an questions or don’t understand what I’m asking about, maybe it will be easier to make a call?

Ahh okay, I understand, I’ve replicated the problem and looking into a solution.

At the moment, I think the order saves the product details on order creation. I’ll look into ways around this early next week.

Thanx a lot, Phil :slight_smile:

Hey @Andriy

There is no way to update the line time through the orders end point. What you need to do is force a refresh of the order cache. You can do this by updating the line item quantity.

Let me know if you have any luck with this approach

Great, thanx
I’ll check and inform you if success :slight_smile:

Yeah, seems update request with the same quantity for each line item is working fine.
Thanx a lot :slight_smile: