drupaldrupal-servicesdrupal-commerce

How to get price of product in Drupal Commerce using Services module?


I installed Services Module and REST Server to get list of products and details. I can only get product display nodes and product id,

but how to get product price and availability info from Drupal Commerce.

List of all nodes (including product display nodes)

http://drupalcommerce.myappdemo.com/services/node

Get single product display node http://drupalcommerce.myappdemo.com/services/node/37

But it does give product id, but not product price.

Please give me an idea how to get one.


Solution

  • check this api's it will help you

     $order = commerce_cart_order_load($uid);
       // Get the order for user just logged in.
        $order_authenticated = reset(commerce_order_load_multiple(array(), array('uid' => $this->store_customer->uid, 'status' => 'cart'), TRUE));
       //update the order status
        $form_state['order'] = commerce_order_status_update($order, 'checkout_checkout', TRUE);
        // Load the order status object for the current order.
        $order_status = commerce_order_status_load($order->status);
        $profile = commerce_customer_profile_load($order->data['profiles'][$checkout_pane['pane_id']]);
        $order = commerce_order_load($order->order_id);
       // Give other modules a chance to alter the order statuses.
        drupal_alter('commerce_order_status_info', $order_statuses);
         $order_state = commerce_order_state_load($order_status['state']);
          // Load the line items for temporary storage in the form array.
        $line_items = commerce_line_item_load_multiple($line_item_ids);
        // load line item
        commerce_line_item_load($line_item_id)
        //load the commerce product
        $product = commerce_product_load($product_id)
         // Load the referenced products.
        $products = commerce_product_load_multiple($product_ids);