VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: zanardi on November 26, 2012, 12:39:15 PM

Title: Add to cart hook without using customfield plugins
Post by: zanardi on November 26, 2012, 12:39:15 PM
Hello, I am using VM 2.0.14.

I am trying to write a plugin and would like a suggestion on which hook I should use.

I need to set an action on "add to cart". I tried with a "VMCustom" plugin, but it seems to me that this is mainly related to custom fields for specific products. I don't want to add a custom field to all my products to be able to trigger my action.
Is there any better hook that I am missing?

Thank you for your time.
Title: Re: Add to cart hook without using customfield plugins
Post by: sandomatyas on March 23, 2016, 11:24:40 AM
Great question.
Is there a plugin method which is triggered when I add a product to the cart (or somwhere around getCart() function)?
Title: Re: Add to cart hook without using customfield plugins
Post by: Studio 42 on March 24, 2016, 00:23:37 AM
You can use a payment or shipment plugin. This get triggered too.
So it depend your need, but you can use 'plgVmOnAddToCartFilter' in VM 3 if a customfield exist or a Joomla plugin too for a more general way to check add to cart.
Title: Re: Add to cart hook without using customfield plugins
Post by: dmb on April 28, 2016, 10:40:12 AM
J3.5.1
VM3.0.16

Hi,

Where's a good place to go to find out more about how to do this ? I need to reprice my cart when a particular product is added to it or taken out (buying membership product gives you discount on all the other ones). I'm piecing the puzzle together but it's hard to know where to start.

Any tips gratefully received !

David
Title: Re: Add to cart hook without using customfield plugins
Post by: Studio 42 on April 28, 2016, 13:11:01 PM
Quote from: dmb on April 28, 2016, 10:40:12 AM
J3.5.1
VM3.0.16

Hi,

Where's a good place to go to find out more about how to do this ? I need to reprice my cart when a particular product is added to it or taken out (buying membership product gives you discount on all the other ones). I'm piecing the puzzle together but it's hard to know where to start.

Any tips gratefully received !

David
Awo coupon PRO can do many of this hooks.