2

I am very new to EE2 and using Expresso Store in one of my websites in EE2 and need to use this hook when the order has completed and payment has been made successfully. The code I need to call is this: ee()->extensions->call('store_order_complete_end', $order);

What I would like to ask is what do I parse to the $data parameter?

When this hook runs, I need to call a function that generates a coupon code and add this code to the database, but what is the $order parameter in this piece of code and where exactly in the project would I call this piece of code?

1 Answer 1

2

You might find the EE Extension Development guide useful.

Basically, you need to create an extension which handles the store_order_complete_end hook. I'm not sure what you mean by the $data parameter, but the $order parameter is a Store Order model. You can access attributes on it like this:

$order->id;
$order->billing_address;
$order->order_total;

The attribute names match those found in the checkout tag.

3
  • Sorry Adrian, I meant $order - Edited this. Thanks
    – heinkasner
    Commented Jun 17, 2014 at 8:07
  • Is there a way to obtain the quantity ordered for each product using the $order array?
    – heinkasner
    Commented Jul 18, 2014 at 13:15
  • Yes. $order->items[0]->item_qty. It's exactly the same as variable names in the checkout tag. Commented Jul 19, 2014 at 17:25

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.