Forum Replies Created

Viewing 16 replies (of 16 total)
  • Thread Starter lunaticalm

    (@lunaticalm)

    I try this action but did not worked for me.

    function add_qty($quantity){
    	global $wpdb, $current_user;
    	get_currentuserinfo();
    	$user_id = $current_user->ID;
    	$thetime=$quantity*60;
    	$user_qty_table=$wpdb->prefix . 'user_qty';
    	$wpdb->update( $user_qty_table , array('Time' => $thetime), array('user_id' => $user_id));
    }
    
    function check_quantity()  {
    global $woocommerce;
    	$my_id = 8;
    	foreach( $woocommerce->cart->cart_contents as $id => $cart_item) {
    	 $quantity=$cart_item['quantity'];
    	if ( $cart_item['product_id'] == $my_id ) {
    	add_qty($quantity);
    	}
    }
    }
    
    add_action('woocommerce_payment_complete', 'check_quantity');

    And this too did not worked for me.
    add_action( ‘woocommerce_order_status_completed’, ‘check_quantity’ );

    Any idea ?

Viewing 16 replies (of 16 total)