• Hello,

    YITH Auctions for WooCommerce plugin is of great value to me and I must tell you. Well done.

    Please I would like to let a customer’s bid only be successful if his wallet balance is sufficient (equal too or greater than the bid), else he gets an alert and remain on the single product page.

    In essence, when a customer who’s wallet balance is too small or insufficient to bid on an auction, when he clicks on bid button; I want an alert message to the customer that his balance is not enough to bid on the product and then prompt him to go and topup his wallet via a link.

    I would like to show the message inline (popup) or inline-embed (on the single product window). Either way is fine. Below is as far as I have got writing the code.

    /* Check woo-wallet balance upon clicking bid button. 
     * If balance is insufficient make bind unsuccessful and display error message saying insufficient wallet balance, 
     * else make bid successful.
     */
    	
    if( !function_exists('yith_wcact_unsuccessful_bid_notice' ) ) {
    function yith_wcact_unsuccessful_bid_notice($userid, $product, $args)
    {
    
      //$product = wc_get_product($product_id);
      if (is_user_logged_in() && woo_wallet()->wallet>get_wallet_balance 
         (get_current_user_id(), 'edit') < $product->get_price('edit')) {
    
           //$passed = false;
    
         wc_add_notice(__('Your eWallet Balance is not sufficient to make the purchase', 
         'yith-auctions-for-woocommerce'), 'error');
         }
         //return $passed;
    
        }
    
        add_action('yith_wcact_bid_validation', 'yith_wcact_unsuccessful_bid_notice', 10, 3);

    I really await your response on this.

    Thank you very much

  • The topic ‘How to check woo-wallet balance upon clicking bid’ is closed to new replies.