0

I have a custom order processor which currently just logs a debug message, so that I know that the order has been processed by it.

For whatever reason, my order processor is never run, I've checked against the docs, looked at how other commerce modules does it (commerce_promotion and commerce_tax), none of them show that I am doing anything wrong.

custom_commerce.services.yml

services:
  custom_commerce.order_tax_processor:
    class: Drupal\custom_commerce\OrderTaxProcessor
    tads:
      - { name: commerce_order.order_processor, priority: 300 }

OrderTaxProcessor.php class

<?php

namespace Drupal\custom_commerce;

use Drupal\commerce_order\Entity\OrderInterface;
use Drupal\commerce_order\OrderProcessorInterface;

/**
 * Provides an order processor that adds tax to order if order has adjustments.
 * It does not affect order items.
 */
class OrderTaxProcessor implements OrderProcessorInterface {

  /**
   * {@inheritdoc}
   */
  public function process(OrderInterface $order) {
    \Drupal::logger('Custom commerce')->debug('Order processed check');
  }
}

Can anyone see what I am doing wrong? Other order processors seem to be running fine, but mine seems to be ignored/not run.

Running Drupal 8.5.3 and Commerce 2.6.0

  • I also have to write a custom processor but I am getting this error... 'commerce_order.order_refresh' does not implement Drupal\commerce_o rder\OrderProcessorInterface. Can you please help me with this – Zaid Khan Oct 28 '19 at 9:18
0

So I found what caused my problem, a silly typo...

Basically, in my custom_commerce.services.yml I had written tads instead of tags.

I fixed it and it's now running as it should.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.