• Resolved Patrick

    (@eberhapa)


    Hi,
    I need to set order_confirmation on a specific product category.
    What I tried:
    1) I activated the option in germanized settings so that all orders have to be checked manually. After that I checked if the order contains a product with the specified category. If not I updated _order_needs_confirmation to false. It works fine but the emails which are sent are wrong.
    2) I deactivated the option and checked if the product with the category is in the order. If yes I used WC_GZDP_Contract_Helper::instance()->set_order_confirmation_needed($order_id);. The emails are correct but the screen after the order is wrong and _order_needs_confirmation is also not set because I’m not able to confirm the order. What am I missing?

    add_action( 'woocommerce_checkout_update_order_meta', 'set_order_confirmation_needed_for_category', 1 );
    function set_order_confirmation_needed_for_category( $order_id ) {
    
      $cat_check = false;
    		
      foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
        
        $product = $cart_item['data'];
      
        if ( has_term( 'yoga-muenzen-ermaessigt', 'product_cat', $product->id ) ) {
          $cat_check = true;
          break;
        }
      }
      
      if ( $cat_check ) {
        //update_post_meta( $order_id, '_order_needs_confirmation', true );
        WC_GZDP_Contract_Helper::instance()->set_order_confirmation_needed($order_id);
      } else {
        //update_post_meta( $order_id, '_order_needs_confirmation', false );
      }
    
    }

    Best,
    Patrick

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Dennis

    (@vdwoocommercesupport)

    Hi,

    I guess that is not that easy to be implemented because some decisions are not made during runtime, e.g. if the manual order confirmation is enabled, some email templates are switched and overridden. You’ll need to investigate our helper class WC_GZDP_Contract_Helper and look through the hooks we are using (e.g. to disable the redirect to the payment provider). As we cannot offer deep individualizations through our support you may need to hire a developer to implement these changes update-safe.

    Cheers

    Thread Starter Patrick

    (@eberhapa)

    Ok, thank you.

    See it as a feature request ??

    Best,
    Patrick

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Order confirmation only for specified category’ is closed to new replies.