Actually it is integrated with mycred I have 3 point types I want if balance is less than order cost then it will deducted from second point type that is why I have included if, else if.

if ( $total_dia < $cost ) {
                $this->mycred->add_creds(
                    'woocommerce_payment',
                    $user_id,
                    0 - $cost,
                    $this->log_template,
                    $order_id,
                    array( 'ref_type' => 'post' ),
                    $puntos_tri
                );
   }
         else if ( $total_tri < $cost ){
             $this->mycred->add_creds(
                 'woocommerce_payment',
                 $user_id,
                 0 - $cost,
                 $this->log_template,
                 $order_id,
                 array( 'ref_type' => 'post' ),
                 $puntos_asa
             );
         }
         else{
             $this->mycred->add_creds(
                 'woocommerce_payment',
                 $user_id,
                 0 - $cost,
                 $this->log_template,
                 $order_id,
                 array( 'ref_type' => 'post' ),
                 $puntos_dia
             );
         }
  • Did you place this inside a hook / function? – Remzi Cavdar Nov 27 at 6:26
  • Yes it is placed in function – Divya Nov 27 at 6:38
  • Hi @Divya, could you provide us with more information, so we're able to take a look. Otherwise, we would need to guess. I understand that it is related to WooCommerce, only I don't know the context. Also, you didn't explain what you're trying to achieve could you write all this? – Remzi Cavdar Nov 27 at 6:43

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.