Skip to content

Instantly share code, notes, and snippets.

View cgdmohamed's full-sized avatar
🎯
Focusing

Moo cgdmohamed

🎯
Focusing
View GitHub Profile
@cgdmohamed
cgdmohamed / woocommerce-allow-one-product-per-category-in-cart.php
Created October 10, 2020 19:06 — forked from Garconis/woocommerce-allow-one-product-per-category-in-cart.php
WooCommerce | Limit one product per specific category in the cart at a time
<?php
// https://www.proy.info/woocommerce-allow-only-1-product-per-category/
// Allow only one(or pre-defined) product per category in the cart
// Alternatively, try plugin: https://wordpress.org/plugins/woo-cart-limit/
add_filter( 'woocommerce_add_to_cart_validation', 'allowed_quantity_per_category_in_the_cart', 10, 2 );
function allowed_quantity_per_category_in_the_cart( $passed, $product_id) {
$max_num_products = 1;// change the maximum allowed in the cart
$running_qty = 0;
@cgdmohamed
cgdmohamed / open_folder_in_PhpStorm_2020.bat
Created September 8, 2020 13:57 — forked from ibrahimhajjaj/open_folder_in_PhpStorm_2020.bat
windows add context open folder in PhpStorm 2020 on right click..
@echo off
SET PhpStormPath=C:\Program Files\JetBrains\PhpStorm 2020.2.1\bin\phpstorm64.exe
echo Adding file entries
@reg add "HKEY_CLASSES_ROOT\*\shell\PhpStorm" /t REG_SZ /v "" /d "Open in PhpStorm" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\PhpStorm" /t REG_EXPAND_SZ /v "Icon" /d "%PhpStormPath%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\PhpStorm\command" /t REG_SZ /v "" /d "%PhpStormPath% \"%%1\"" /f
echo Adding within a folder entries