I want to modify a line item price adding a variable charge depending on the product with Ajax temporarily and pass it to my checkout and be available to charge it.
I try modifying directly, changing the price like this:
const productData = {
id: variant_id,
quantity: qty,
price:newCharge,
properties: deliveryDate
? {
_handle: handle,
...customProperties,
}
: { _handle: handle, ...customProperties },
};
await $.post("/cart/add.js", productData, null, "json");
It seems not to replace directly the price, I also look to the documentation to take in deep about the properties supports, but I didn’t see anything that would help me about.
But if there’s no way to modify the line item price, I was trying to modify directly the subtotal adding the charge that I need. So that’s it basically
Any suggestion or opinion would be good to receive it