Skip to content

Commit

Permalink
check product is deleted before add to cart
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Feb 25, 2022
1 parent cc5947c commit 7636126
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/MicroweberPackages/Cart/CartManager.php
Expand Up @@ -565,7 +565,21 @@ public function update_cart($data)
}

if ($data['for'] == 'content') {

$cont = $this->app->content_manager->get_by_id($for_id);

if (isset($cont['is_active'])) {
if ($cont['is_active'] != 1) {
$cont = false;
}
}

if (isset($cont['is_deleted'])) {
if ($cont['is_deleted'] > 0) {
$cont = false;
}
}

$cont_data = $this->app->content_manager->data($for_id);
if ($cont == false) {
return array('error' => 'Invalid product?');
Expand Down

0 comments on commit 7636126

Please sign in to comment.