Search
 
SCRIPT & CODE EXAMPLE
 

PHP

one item limit on cart in woocommerce

add_filter( 'woocommerce_add_to_cart_validation', 'only_one_item_in_cart', 9999, 2 );
   
function only_one_item_in_cart( $passed, $added_product_id ) {
   wc_empty_cart();
   return $passed;
}
Comment

PREVIOUS NEXT
Code Example
Php :: php extract email address from string 
Php :: php string starts with 
Php :: img src php wordpress 
Php :: checks input if number only in php 
Php :: How can I prevent SQL injection in PHP? 
Php :: laravel pass parameter to resource collection 
Php :: run artisan command from controller 
Php :: cart icon in woocommerce 
Php :: mySQL phpMyAdmin with Google Chrome: stuck on loading 
Php :: laravel session put method 
Php :: add a new column to existing table in a migration 
Php :: php remove wordpress shortcodes 
Php :: Detecting russian characters on a form in PHP 
Php :: get the last inserted id using laravel eloquent 
Php :: php classes 
Php :: laravel forelse 
Php :: Deprecated Functionality: stripos() 
Php :: php get prameter 
Php :: drupal 9 enable PHP errors 
Php :: laravel not in query 
Php :: Laravel loop iternation pagination issue 
Php :: how to separate date and time in laravel 
Php :: confirm password validation laravel 
Php :: php executable not found visual studio code ubuntu 
Php :: convert post name to id 
Php :: create new laravel project cmd 
Php :: difference betwen include and indlude once 
Php :: php call protected function from child class 
Php :: php check array is not associative 
Php :: php pass variable to anonymous function 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =