[ic] Change Price of Items in Cart

Jon Jensen jon at endpoint.com
Sat Feb 20 20:53:35 UTC 2021


On Fri, 19 Feb 2021, mihai at airdelights.com wrote:

> I am trying to change the price of certain products in the my cart based 
> on a new table I made for refunds. The following simple code works fine 
> for changing the quantity, but not the price. (@p contains the ordered 
> prices of items in the cart pulled from my returns_db table).
>
> # Set the price
> my $cnt = 0;
> for my $item (@{$Items}){
> 	$item->{price} = $p[$cnt];
> 	$cnt++;
> }
>
> I've tried a variety of other approaches, but I cannot seem to change 
> the price of anything in the cart. Is there something I'm missing? Can I 
> know change prices of cart items on the fly?

Mihai,

Price is not like the other cart attributes because it is usually a 
dynamic amount that may include discounts affected by quantity, sale 
prices, options selected, etc.

If you want to specify a per-cart item price, try using attribute mv_price 
and see your catalog.cfg (or include files) for PriceField and 
CommonAdjust, which in the strap demo configuration is:

CommonAdjust   pricing:q5,q10 ;:sale_price, ;:price, ;$, :related, ==:options

It has powerful, complicated syntax:

https://www.interchangecommerce.org/docs/confs/CommonAdjust.html

HTH,
Jon


-- 
Jon Jensen
End Point Corporation
https://www.endpoint.com/


More information about the interchange-users mailing list