• Resolved Maya

    (@tdgu)


    In a previous plugin update, there where 2 new actions inincludes/mollie/wc/helper/orderlines.php at process_items() method:
    do_action( Mollie_WC_Plugin::PLUGIN_ID . '_orderlines_process_items_before_getting_product_id', $cart_item );
    and
    do_action( Mollie_WC_Plugin::PLUGIN_ID . '_orderlines_process_items_after_processing_item', $cart_item );
    Those works great and i was able to achieve my code functionality thorough it.

    In recent update at /mollie-payments-for-woocommerce/includes/mollie/wc/gateway/abstract.php at process_payment() method, at order loop items ( foreach ( $order->get_items() ) you add just the first action but not the second, this produce an issue since we can’t run specific code when the loop ends. Can you update the code and add the ending action, just like above method? So this should looks like this:

    foreach ( $order->get_items() as $cart_item ) {
    
    	if ( $cart_item['quantity'] ) {
    
    		do_action( Mollie_WC_Plugin::PLUGIN_ID . '_orderlines_process_items_before_getting_product_id', $cart_item );
    
    		if ( $cart_item['variation_id'] ) {
    			$product = wc_get_product( $cart_item['variation_id'] );
    		} else {
    			$product = wc_get_product( $cart_item['product_id'] );
    		}
    
    		if ( $product == false ) {
    			$mollie_payment_type = 'payment';
                
                do_action( Mollie_WC_Plugin::PLUGIN_ID . '_orderlines_process_items_after_processing_item', $cart_item );
    			
                break;
    		}
            
            do_action( Mollie_WC_Plugin::PLUGIN_ID . '_orderlines_process_items_after_processing_item', $cart_item );
    	}
    }

    Thanks

    • This topic was modified 5 years, 10 months ago by Maya.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor davdebcom

    (@davdebcom)

    Ok, adding this. In your code you have the action twice, special reason for that or not? If there is none, I’ll only add the last one.
    https://take.ms/Bc0gm

    Thread Starter Maya

    (@tdgu)

    There is a break in your loop, so the code need to trigger booth filters (before and after), or it will break our code.
    Imagine on before filter, the site is switched to product location, then on after the default is restored. Obviously, if reach the break line it will not trigger the after filter so no site restore.

    Hope it makes sense.

    Hi David,

    Wanneer wordt deze filter weer toegevoegd? Ik wacht hier namelijk op (kan niet updaten naar 5.1.7 wegens deze missende filter)

    Ik hoor graag van je!

    Groet,

    Sander

    Plugin Contributor davdebcom

    (@davdebcom)

    Today or tomorrow.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Missing filter’ is closed to new replies.