Mailing List Archive

Change Price of Items in Cart
Hello all,

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?

Thank you in advance for all the help and I hope you have a great weekend.

______________________

Mihai Dan
Air Delights, Inc.
https://www.airdelights.com
1 (800) 440-5556

_______________________________________________
interchange-users mailing list
interchange-users@interchangecommerce.org
https://www.interchangecommerce.org/mailman/listinfo/interchange-users
Re: Change Price of Items in Cart [ In reply to ]
On Fri, 19 Feb 2021, mihai@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/
_______________________________________________
interchange-users mailing list
interchange-users@interchangecommerce.org
https://www.interchangecommerce.org/mailman/listinfo/interchange-users