0

Hi I am really new to expressionengine and I'm currently using a module for store called expresso. Now I want to use their webhooks to update some functionalities before adding item to cart. Now, my problem is I don't know how to implement it.

I know I have to do this:

public function existing_webhook_name()
{
    //do php here..
}

but where should I place that function? Can I place it anywhere? I mean including in the templates? or there should be a file dedicated to webhooks in expressionengine.

Please help. Thanks!

0

Using Expresso Store's extension hooks is exactly the same as using EE's own extension hooks. Might be worth reading the full background on how extensions work if you're unfamiliar: https://docs.expressionengine.com/v2/development/extensions.html

In a nutshell, you'll need to create an extension file in the third_party directory with some skeletal code, install that extension via the EE control panel, then proceed to edit your code until it does what you want.

Here's a handy extension boilerplate file from Rob Sanchez to get you started: https://github.com/rsanchez/generator-ee-addon/blob/master/app/templates/ext.php.handlebars

| improve this answer | |
  • Hi @James, thank you for answering my question. But, the weebhook that I'll be using is existing in expresso already this one store_order_item_add_end()/store_order_item_add_start().. I thought this webhooks are configured well already I mean it already has the extension files and functions and then I just have to add that function somewhere??. Please correct me if I'm wrong.. Thanks – cm.beth Jun 8 '16 at 2:20
  • The hook exists, yes, but in order to use a hook you need to create and install an extension file. So for example you could call it something generic like ext.store_helpers.php (which would allow you to access any number of hooks from within it), and then in that file, follow the instructions for creating an extension linked to in my answer. – James Smith Jun 8 '16 at 7:36
  • hmmm, I'm starting to understand it.. so this {{method}} is where my additional functionality or changes goes?.. @James – cm.beth Jun 9 '16 at 8:41
  • 1
    woahhhh.. great, just great.. thanks @James it's working really. – cm.beth Jun 9 '16 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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