Hello Shopify devs, I am reporting a bug.
If a variant with a selling plan is added to the cart before the variant is added again as a one time product, the cart.line_item.cost.amountPerQuantity.amount
for the one time product is returned as the price of the subscription variant when the function runs. The order matters. If the order is reversed (one time variant first, then subscription variant) everything is fine.
Attached is a cart.json which shows the two line items with the correct price and a function run log for that cart which shows the discounted subscription variant price being incorrectly for both lines.