Get order on guest checkout

  • Posts: 206
  • Thank you received: 10
  • Hikashop Multisite
6 months 2 weeks ago #361436

Hi,

I have a hikashop type plugin which start with:

public function onAfterOrderCreate($order,$send_email)
	{
		// Get Full Order
		$orderClass = hikashop_get('class.order');
		$order = $orderClass->loadFullOrder($order->order_id);

		var_dump($order->order_id);die;

When i have a registered account who creates an order i see the order_id as expected
When i have a guest checkout the reply is NULL

What can i do to get the order_id in the case of a guest checkout?

Thanks in advance

Please Log in or Create an account to join the conversation.

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
6 months 2 weeks ago #361437

Hi,

The loadFullOrder function has a built-in check to verify that the current user has the right to load the data of the order.
If you don't want this check to be done, you need to call it like this instead:

$order = $orderClass->loadFullOrder($order->order_id, false, false);

Please Log in or Create an account to join the conversation.

  • Posts: 206
  • Thank you received: 10
  • Hikashop Multisite
6 months 2 weeks ago #361439

Thank you!

Please Log in or Create an account to join the conversation.

Time to create page: 0.058 seconds
Powered by Kunena Forum