by matotominac | Jun 25, 2018 | Quick Code | Craft CMS, Craft Commerce
class PluginNamePlugin extends BasePlugin { public function init() { // Clear cart before new product is added craft()->on('commerce_cart.onBeforeAddToCart', function($event){ $cart = craft()->commerce_cart->getCart();...
by matotominac | Apr 5, 2018 | Quick Code | Craft CMS, plugin development
// First we create empty category model $newCategory = new CategoryModel(); // Now we assign our new category to category group. // You can find category group id inĀ /admin/settings/categories. $newCategory->groupId = $categoryGroupId; // Give our new category a...