PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, May 15, 2022

[FIXED] How to find your action in admin-ajax.php file?

 May 15, 2022     woocommerce, wordpress, wordpress-hook     No comments   

Issue

I am using woo commerce plugin for my eCommerce website. There are some order listed on my dashboard. When I change status of an order from processing to completed we click on button.

Here is my action goes:

if ( in_array( $the_order->post_status, array('wc-pending', 'wc-on-hold', 'wc-processing') ) )
     $actions['complete'] = array(
         'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=upen-mark-order-complete&order_id=' . $the_order->id ), 'upen-mark-order-complete' ),
         'name' => __( 'Dispatched', 'dokan' ),
         'action' => "complete",
         'icon' => '<i class="fa fa-truck">&nbsp;</i>'
     );

But when I am looking into admin-ajax.php file there is no order_id getting. I am confused that where these attributes are we getting to change order status like action, order_id etc.


Solution

You should read wp_ajax_(action).

based on your given code, there should be something like this implemented somewhere... maybe on your theme files or plugin files..

add_action( 'wp_ajax_upen-mark-order-complete', 'my_action_callback' );

function my_action_callback() {

    $order_id = $_GET['order_id'];

    wp_die(); 
}

additionally,
With notepad++ you can search it in your files like this..

enter image description here



Answered By - Reigel
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing