1

I'm new to cartthrob and want to know how can a product be automatically deleted if that product has been purchased from current logged in user. Let's see it as a scenario I'm logged out and I add that product into cart and while checkout I get asked to login and After I login that product gets added to cart even if I've already purchased that product to cart....so please tell me how can I remove that product automatically in Expressionengine cartthrob?

1 Answer 1

0

You'll need to create an extension on the cartthrob_add_to_cart_start hook. This hook runs right before the process of adding an item to the cart so you can check if the member has purchased said product and then apply the end_script value and stop execution to meet your needs

2
  • Can you explain a bit more I mean where can I find this hook? Is it in Cartthrob addon file?
    – Ram
    Nov 30, 2023 at 10:25
  • Yeah, it's within the CartThrob Add-on. There are 2 calls to it, the Tag and Action. If you're using the add_to_cart_form tag already, you'll want the Action one located at cartthrob/src/Actions/AddToCartAction.php
    – Eric Lamb
    Dec 2, 2023 at 2:36

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.