Jump to content

Kristian

New Member
  • Posts

    1
  • Joined

  • Last visited

About Kristian

Kristian's Achievements

Junior Member

Junior Member (1/3)

0

Reputation

  1. Hi ! Im trying to make a hook that only lists products in stock in certain category but im sure im missing something. Did any one tried to set up something similar. Code to my hook: use WHMCS\Database\Capsule; add_hook('ShoppingCartProductList', 1, function($vars) { $categoryId = 15; $products = Capsule::table('tblproducts') ->where('category', $categoryId) ->get(); $productsInStock = []; foreach ($products as $product) { if ($product->stockcontrol && $product->qty > 0) { $productsInStock[] = $product; } } $vars['productList'] = $productsInStock; return $vars; });
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated