Specify a pickup location when placing an order using the API

Good day. I would like to know how I can specify a pickup location when placing an order using the standard API? The store_locator module is installed, everything is configured, and judging by the source code of the module, we can say that before placing an order, the fn_store_locator_api_orders_create_before_place_order hook is triggered, which should process the selected pickup point.

Test request

POST: https://example.com/api/Orders

{
 "user_id": $user_id,
 "profile_id": $profile_id,
 "payment_id": $payment_id,
 "shipping_id": $shipping_id, (Pickup)
 "products": {
 "$product_id": {
 "amount": 1
 }
 },
 "select_store": $select_store
}

But a pickup point is not assigned to the order. What could be the problem?

1 Like

Also tried

{
 "user_id": $user_id,
 "profile_id": $profile_id,
 "payment_id": $payment_id,
 "shipping_ids": [
   $shipping_id
]
 "products": {
    $product_id: {
       "amount": 1
 }
 },
 "select_store": [
    {
       $shipping_id: $store_location_id
    }
]
}

@CS-Cart_team what’s wrong?

CS-Cart version: Multi-Vendorv4.15.1.SP2
Store location module version: 1.0

Hi!

The possibility to select pickup points via API was added in 4.15.2. The syntax should be the following:

{
  ...
  "select_store": {
    "0": {
      "shipping_method_id": pickup_location_id
    },
    ...
    in case vendors are present in the order
    "1": {
      "shipping_method_id": pickup_location_id
    }
    ...
  }
  ...
 }

Hello !

I am working with API and am trying to create a order with a pickup location ,

this is an example of the payload
endpoint /api/orders
{
“user_id”: “2300”,
“payment_id”: “28”,
“shipping_id”: “165”,
“products”: {
“1”: {
“product_id”: “428354”,
“amount”: “1”
},
“2”: {
“product_id”: “428327”,
“amount”: “1”
}
},
“select_store”: {
“0”: {
“shipping_method_id”: “6”
}
}
}

this creates correct the shipping method but doesn’t select an pickup location,

Does the response of @CS-Cart_team helped you ?

Tried in demo. Doesn’t work for multiple vendors

Answered in direct messages. Will copy here:

Since this is Multi-Vendor, you definitely need to specify vendor specific cart ID in the select_store element:

	"select_store": {
		"1": {
			"165": 6
		}
	},

try this one. And make sure that the pickup location is available for the customer’s location.

2 Likes