Viewing 3 replies - 1 through 3 (of 3 total)
  • Amir A. (woo-hc)

    (@amiralifarooq)

    Hi @pimonda1

    Thanks for reaching out!

    I understand that you want to disable “order completed” emails to customers for specific WooCommerce products.?

    These forums are meant for general support with the core functionality of WooCommerce itself. What you want to achieve is a bit complex and would require customization to do it. Since custom coding is outside our scope of support, I am leaving this thread open for a bit to see if anyone can chime in to help you out.

    For questions related to development and custom coding, your best bet is to ask on any of these channels for support. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, too.

    – WooCommerce Developer Resources Portal
    – WooCommerce Advanced Facebook group
    – WooCommerce Community Forum
    – WooCommerce Developer Slack Channel.
    – Hire a WooCommerce Expert

    Additionally, you could check these articles for reference as well:

    –?WooCommerce Disable Completed Email to Customer on Specific Orders
    –? https://woocommerce.com/document/unhookremove-woocommerce-emails/
    –?

    Hope this helps!

    Hi @pimonda1

    Please use following code for preventing order completed email notification to customers and replace !!!PRODUCT_ID!!! with actual product id.

    For multiple products, use product array check or simple or product id check.

    function prevent_email_for_specific_product_customer_completed_order_func( $recipient, $order ) {
    
      $noNotificationProduct = false;
    
      $items = $order->get_items();
    
      foreach ( $items as $item ) {
    
        $product_id = $item->get_product_id();
    
        if (intval($product_id) == !!!PRODUCT_ID!!!) {
    
          $noNotificationProduct = true;
    
        }
    
      }
    
      if ($noNotificationProduct) {
    
        $recipient = "";
    
      }
    
      return $recipient;
    
    }
    
    add_filter( 'woocommerce_email_recipient_customer_completed_order', 'prevent_email_for_specific_product_customer_completed_order_func', 10, 2 );
    Thread Starter pimonda1

    (@pimonda1)

    Hola @asad1050 ,

    FIrst of all thanks for your help, amazing! I was wondering is there also a way to do this based on product tag or category?

    And if not, can you provide an example of the code when we want to add many Product ID (sorry we are not technical so need some guidance haha)

    thanks a lot, great help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Disable order completed email for specific products’ is closed to new replies.