0

I am stuck at integrating a Drupal Commerce store with Services.

I setup a REST server. In several steps I can login, create a user, create user shipping/billing profiles, create an order, add line-items to that order. This works fine, even a correct total gets calculated. I then need a bunch of rules and some hooks to get triggered to make invoicing happen and to send out emails. This fails. I tried to trigger this by changing the order status. Maybe I haven't done it right.

Drupal 7 Modules I use:

  • Services
  • Commerce Services
  • Services Entity

How can I make a D7 Drupal Commerce order generated through Services invoke hooks and rules? To make it simpler: How can I invoke the checkout complete process through services?

0

So, for anyone looking for a solution, here is what I did after asking for help in IRC #drupal-commerce:

Don't use the order status, don't use a checkout-status. Use something (an entity) as a trigger that is necessary for creating the order. I picked the last action provided via .json-file, POSTing a line-item. As soon as this is known by Drupal, all corresponding rules start their work, and some hooks respectively.

Sidenote: I learned something else also and wished to have been pointed to that earlier: Next time I will not use the above mentioned modules again. They're buggy and obsolete in D8 anyway since the concurring RESTws module became part of core.

  • 1
    I had luck using JSONAPI module in D8. You are able to do almost everything with it. – esafwan Jun 12 '18 at 0:42

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.