diff --git a/functions/data-request.php b/functions/data-request.php
index fa32e844..943af81d 100644
--- a/functions/data-request.php
+++ b/functions/data-request.php
@@ -783,6 +783,9 @@ function dolicart_request() {
if (isset($_POST['modify']) && $_POST['modify'] == "delete") {
$price = doliProductPrice($product, 0, false, true);
$result = doliaddtocart($product, $mstock, 0, $price, null, null);
+ if (!empty(doliRequiredRelatedProducts($product->id, null, false))) {
+ $result = doliRequiredRelatedProducts($product->id, $qty, true);
+ }
$response = [
'message' => dolialert('success', $result['message']),
'newqty' => $result['newqty'],
@@ -805,7 +808,7 @@ function dolicart_request() {
$price = doliProductPrice($product, $qty, false, true);
$result = doliaddtocart($product, $mstock, $qty, $price, isset($_POST['product-add-timestamp_start'])?trim($_POST['product-add-timestamp_start']):null, isset($_POST['product-add-timestamp_end'])?trim($_POST['product-add-timestamp_end']):null);
if (!empty(doliRequiredRelatedProducts($product->id, null, false))) {
- $result2 = doliRequiredRelatedProducts($product->id, $qty, true);
+ $result = doliRequiredRelatedProducts($product->id, $qty, true);
}
$response = [
'message' => dolialert('success', $result['message']),
@@ -815,8 +818,8 @@ function dolicart_request() {
'total' => $result['total']
];
- if ($qty != $result['newqty']) { $response['modal'] = doliModalTemplate('CartInfos', __( 'Cart', 'doliconnect'), __( 'This item is not available in this quantity!', 'doliconnect'), ' '.__( 'Finalize the order', 'doliconnect').'', 'modal-lg'); }
- elseif (doliCheckModules('relatedproducts') && doliCheckRelatedProducts($product->id)) { $response['modal'] = doliModalTemplate('CartInfos', __( 'Related products', 'doliconnect'), doliRelatedProducts($product->id), '', 'modal-lg', null, 'p-0'); }
+ //if ($qty != $result['newqty']) { $response['modal'] = doliModalTemplate('CartInfos', __( 'Cart', 'doliconnect'), __( 'This item is not available in this quantity!', 'doliconnect'), ' '.__( 'Finalize the order', 'doliconnect').'', 'modal-lg'); }
+ if (doliCheckModules('relatedproducts') && doliCheckRelatedProducts($product->id)) { $response['modal'] = doliModalTemplate('CartInfos', __( 'Related products', 'doliconnect'), doliRelatedProducts($product->id), '', 'modal-lg', null, 'p-0'); }
wp_send_json_success($response);
die();
} elseif (isset($_POST['modify']) && ($_POST['modify'] == "wish" || $_POST['modify'] == "unwish")) {