I am working with Drupal 7 web services. I created few services on my project but now stuck in the commerce's services.

I could not understand how can I add an item to cart with some line item values through web services. What will be the json structure ?

The commerce's cart, checkout, review perform many functions through rules and hooks, so are we going to write code for all of those steps in our custom services module?

1 Answer 1


I have found a similar post on stackexchange, which is little bit helpful. Click here!

But there, they have used commerce line item's ids which will not available in my case because how could we know the lineitem's id before submitting it to cart ?.

Found the below solution for my above query. But I am not sure, what are the standard way to implement this.

1) First I have to create an cart order using commerce services module. http://localhost:8080/drupal7/serviceendpoint/cart

2) Second I have to create new line item and attach it to the order created above using the same module. http://localhost:8080/drupal7/serviceendpoint/line-item

In that way I am able to create a new order with line items. But I will appreciate if anyone could suggest me a clean, better and a proper way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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