Skip to content

Instantly share code, notes, and snippets.

Avatar

Imran Hossain imranh654

  • NextEvoIT
  • Dhaka, Bangladesh
View GitHub Profile
@imranh654
imranh654 / countries
Created Dec 21, 2020 — forked from kalinchernev/countries
Plain text list of countries
View countries
Afghanistan
Albania
Algeria
Andorra
Angola
Antigua & Deps
Argentina
Armenia
Australia
Austria
@imranh654
imranh654 / lenura_empty_cart_before_add.php
Created Oct 2, 2017 — forked from viniciusrtf/lenura_empty_cart_before_add.php
WooCommerce Hook: Empty cart before adding a new product to cart WITHOUT throwing woocommerce_cart_is_empty
View lenura_empty_cart_before_add.php
<?php
/**
* Hook: Empty cart before adding a new product to cart WITHOUT throwing woocommerce_cart_is_empty
*/
add_action ('woocommerce_add_to_cart', 'lenura_empty_cart_before_add', 0);
function lenura_empty_cart_before_add() {
global $woocommerce;
// Get 'product_id' and 'quantity' for the current woocommerce_add_to_cart operation