• Resolved wpsitemason

    (@wpsitemason)


    Love the plugin! As always, clients have creative requests. I’m trying to send the “Request for New Quote” email to different admin addresses based on the category of the product(s) in the cart.

    I found a similar post in this forum requesting the same thing but for the state. I used that code to try and create something similar but I am getting an error at checkout. Strangely the order/quote is processed and I can see it on the backend but no notifications are being sent and the user receives a checkout error.

    Here is the code I’m using…

    add_filter( 'woocommerce_email_recipient_qwc_req_new_quote', 'custom_quote_email_recipient', 10, 2 );
    
    function custom_quote_email_recipient( $recipient, $order_id ) {
    
      // Get order object from ID
        $order_id = $order->order_id;
        $wc_order_obj = wc_get_order( $order_id );
    
      // Category slugs and emails
      $equipment_cat = 'equipment'; 
      $equipment_email = '[email protected]';
    
      $party_cat = 'party';
      $party_email = '[email protected]';
    
      // Get order items
      $items = $order->get_items();
    
      // Check categories
      foreach ( $items as $item ) {
        $product = $item->get_product(); 
        $categories = wc_get_product_category_list( $product->get_id() );
    
        if ( in_array( $equipment_cat, $categories ) ) {
          $recipient = $equipment_email;
          break;
        } elseif ( in_array( $party_cat, $categories ) ) {
          $recipient = $party_email;
          break;
        }
      }
      
      return $recipient;
    
    }

    I am glad to pay you to troubleshoot this with me and/or provide this customization. Thanks.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author pinal.shah

    (@pinalshah)

    Hi @wpsitemason,

    Sure, I can help you with this.

    I can provide you a customization. We can discuss it in detail on email. Please send me an email to pinalj1612 at gmail dot com to take it further.

    Thanks,

    Pinal

Viewing 1 replies (of 1 total)
  • The topic ‘Sending to Different Admin Emails Based on Category’ is closed to new replies.