Skip to content

How to update Quote Item Prices

I have my custom module Pricebycustomergroup i have created a rule where a specific product price will be decreased like orignal is 34$ and the new one will be 20$ but this will works if max quantity is 2 in cart..

I wanted to create graphql APIs for this now what i do is i use AfterGetPrice Plugin

public function afterGetPrice(Product $subject, $result)
{
    if ($this->state->getAreaCode() === Area::AREA_WEBAPI_REST || $this->state->getAreaCode() === Area::AREA_GRAPHQL) {
        //my code here
    }
    return $result;
}

It is working fine but the issue is quantity logic failed like what i did is for quantity greater than 2 for that specific product logic not working because it will always return the same price every time.. another option is i can use cart here but what in case of guest cart ?

Please help Thanks in advance !!