Custom attributes not updating

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
DamanMokha
Posts: 13
Joined: 29 Mar 2023, 03:00

Custom attributes not updating

Post by DamanMokha » 21 May 2023, 13:37

Hi,
I am using the headless version of Aimeos(2023.04.*) and have created custom attributes, including the ability to set a custom price for a product. When adding a product to the cart, the custom price and other custom attributes such as weight are successfully saved. However, when updating the cart, only the quantity is being updated and the custom attributes remain unchanged.

I am using the following update API endpoint:

Code: Select all

 /jsonapi/basket?id=default&&related=product&relatedid=0
with the PATCH method. The following is the body of the request:

Code: Select all

{
    "data": {
        "attributes": {
            "quantity": 1,
            "custom": {
                "7": "12.22",
                "29": "12"
            }
        }
    }
}
7th id is for the custom price, it's working fine while adding but not updating, can you please help me out.

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Custom attributes not updating

Post by aimeos » 24 May 2023, 09:04

You can only change the quantity using the PATCH method for the basket/product endpoint:
https://aimeos.org/docs/latest/frontend ... t-products

If you want to change the configurable or custom attributes of a product in the basket, you have to remove the product from the basket first and add it again afterwards using the new configurable or custom attributes.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply