- This topic has 4 replies, 2 voices, and was last updated 8 years, 1 month ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.
Support site for Tips and Tricks HQ premium products
by
Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Tweaks › eStore – Is there a hook for product creation
Tagged: api, estore api, filter, hooks, Tweaks
I’m looking for a place to hook into product creation / update to change the available_copies and run another function to create a custom post on product creation with the product id.
Do you have a hook for right after a product is created and for after a product is updated (in the admin end).
Is there a hooks list somewhere for eStore? Or an API?
Thanks,
Jan
We have the following two action hooks that should help you.
eStore_new_product_added
add_action('eStore_new_product_added', 'custom_task_after_product_added', 10, 2);
function custom_task_after_product_added($data, $prod_id){
//print_r($data); //uncomment this to see what data is passed here.
}
eStore_product_updated
add_action('eStore_product_updated', 'custom_task_after_product_updated', 10, 2);
function custom_task_after_product_added($data, $prod_id){
//print_r($data); //uncomment this to see what data is passed here.
}
Looks like exactly what I need! Thanks a bunch.
Do you also have a hook for when a sale is completed by a customer ( where the inventory is updated )?
Thanks again,
Jan
Yes. You can use the following hook:
add_action('eStore_product_database_updated_after_payment', 'custom_task_after_sale', 10, 2);
function custom_task_after_product_added($payment_data, $cart_items){
//TODO
}
Perfect!
Thank you very much.
Jan