summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/utils/cart.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core/utils/cart.js b/src/core/utils/cart.js
index 6575f6d0..eb411dd3 100644
--- a/src/core/utils/cart.js
+++ b/src/core/utils/cart.js
@@ -30,12 +30,17 @@ const setCart = (cart) => {
return false
}
-const addCart = async (product_id, qty, selected) => {
+const addCart = async (product_id, qty, selected, programLineId = null) => {
const data = {
'product_id' : product_id,
'qty' : qty,
'selected' : selected,
}
+ if(programLineId){
+ data += {
+ 'program_line_id' : programLineId,
+ }
+ }
const id = getAuth()?.id
const cartAdd = await odooApi(
'POST',
@@ -89,12 +94,12 @@ const getItemCart = ({ productId }) => {
* @param {boolean} [options.selected=false] - The new selected status of the product in the cart. Default is `false`.
* @returns {boolean} - Returns `true`.
*/
-const updateItemCart = ({ productId, quantity, selected = false }) => {
+const updateItemCart = ({ productId, quantity, selected = false , programLineId}) => {
let cart = getCart()
quantity = parseInt(quantity)
cart[productId] = { productId, quantity, selected }
setCart(cart)
- addCart(productId, quantity, selected)
+ addCart(productId, quantity, selected, programLineId)
return true
}