# woocommerce-pos/1.10.16/includes/AJAX.php

WCPOS – Point of Sale (POS) plugin for WooCommerce, version 1.10.16. 100 lines.

- Page: https://pluginprobe.com/plugins/woocommerce-pos/1.10.16/code/includes/AJAX.php
- Raw: https://pluginprobe.com/plugins/woocommerce-pos/1.10.16/raw/includes/AJAX.php
- Modified: 2026-08-25T07:52:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/woocommerce-pos/1.10.16/code/includes/AJAX.php#L10-L20`.

```php
<?php
/**
 * AJAX.
 *
 * @package WCPOS\WooCommercePOS
 */

namespace WCPOS\WooCommercePOS;

use WCPOS\WooCommercePOS\Admin\Products\Single_Product;
use WCPOS\WooCommercePOS\Admin\Products\List_Products;

/**
 * AJAX class.
 */
class AJAX {
	/**
	 * WooCommerce AJAX actions that we need to hook into on the Product admin pages.
	 *
	 * @var string[]
	 */
	private $single_product_actions = array(
		'woocommerce_load_variations',
		'woocommerce_save_variations',
	);

	/**
	 * WooCommerce AJAX actions that we need to hook into on the Product admin pages.
	 *
	 * @var string[]
	 */
	private $list_products_actions = array(
		'inline_save', // this is a core WordPress action and it won't call our hooks?? I don't know why.
	);

	/**
	 * Constructor.
	 */
	public function __construct() {
		if ( ! isset( $_REQUEST['action'] ) ) {
			return;
		}

		// ignore for WP Admin heartbeat requests.
		// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Only reading action name, no form processing.
		if ( isset( $_POST['action'] ) && 'heartbeat' === $_POST['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
			return;
		}

		foreach ( $this->single_product_actions as $ajax_event ) {
			add_action( 'wp_ajax_' . $ajax_event, array( $this, 'load_single_product_class' ), 9 );
		}
		foreach ( $this->list_products_actions as $ajax_event ) {
			add_action( 'wp_ajax_' . $ajax_event, array( $this, 'load_list_products_class' ), 9 );
		}

		// we need to hook into these actions to save our custom fields via AJAX.
		add_action(
			'woocommerce_product_quick_edit_save',
			array(
				'\WCPOS\WooCommercePOS\Admin\Products\List_Products',
				'quick_edit_save',
			)
		);

		/**
		 * Fix for AJAX quick edit.
		 *
		 * @TODO - I need to fix this AJAX mess.
		 * When a quick edit is saved, WooCommerce returns a re-rendered row to replace the existing row.
		 * Because it's via AJAX, our 'manage_product_posts_custom_column' hook won't run, so it won't include our updated value.
		 *
		 * I have loaded the List_Products class here for the wp_ajax_inline_save hook .
		 */
		if ( 'inline-save' === $_REQUEST['action'] ) {
			new List_Products();
		}
	}

	/**
	 * The Admin\Products\Single_Product class is not loaded for AJAX requests.
	 * We need to load it manually here.
	 *
	 * @return void
	 */
	public function load_single_product_class() {
		$single_product_class = apply_filters( 'woocommerce_pos_single_product_admin_ajax_class', Single_Product::class );
		new $single_product_class();
	}

	/**
	 * The Admin\Products\List_Products class is not loaded for AJAX requests.
	 * We need to load it manually here.
	 *
	 * @return void
	 */
	public function load_list_products_class() {
	}
}

```
