Answers for "woocommerce: check if product is in cart"

0

woocommerce check if product is variable

global $product;

// $product->is_type( $type ) checks the product type, string/array $type ( 'simple', 'grouped', 'variable', 'external' ), returns boolean

if ( $product->is_type( 'variable' ) ) {}
Posted by: Guest on January-21-2021
0

check if a customer bought the product woocommerce

if ( !function_exists( 'wc_customer_bought_product' ) ) { 
    require_once '/includes/wc-user-functions.php'; 
} 
  
// The customer email. 
$customer_email = ''; 
  
// The user id. 
$user_id = -1; 
  
// The product id. 
$product_id = -1; 
  
// NOTICE! Understand what this does before running. 
$result = wc_customer_bought_product($customer_email, $user_id, $product_id); 
    
Copy
Posted by: Guest on January-06-2022

Code answers related to "woocommerce: check if product is in cart"

Browse Popular Code Answers by Language