I've created a plugin related to woocommerce then created a shortcode in a class. And in my class is these:
class MyShortcode
{
/**
* Register services and applications
*/
public function register()
{
add_shortcode('myshortcode', [$this, 'basket']);
add_action('wp_enqueue_scripts', [$this, 'activitiesEnqueueStyles']);
add_action('woocommerce_review_order_after_payment', [$this, 'action_function_name_2183', 10, 3]);
}
/**
* Enqueue styles and scripts
*/
public function activitiesEnqueueStyles()
{
wp_enqueue_style('basket', $this->plugin_url . 'assets/lib/basket.min.css');
}
public function action_function_name_2183( $order_id, $posted_data, $order )
{
var_dump('here');
var_dump($order_id);
exit;
}
I wanted to retrieve the order id after placing order or payment which is the hook add_action( 'woocommerce_review_order_after_payment', [$this, 'action_function_name_2183', 10, 3] );
but it is completely ignored whenever I try to submit the payment form.
I've been reading this guide to check the hooks and tried some of them which actually works but for some reason, only this hook woocommerce_review_order_after_payment
is not working on my end.
Currently, got no idea why it's not working. The other action hooks are working aside from woocommerce hooks. I'm not sure if there is anything I need to do before using the hooks.
If there are any related links to this, you can link them below, as I've tried looking for something related to this but can't find any.