| Server IP : 62.72.47.131 / Your IP : 216.73.217.34 Web Server : Apache/2.4.66 (Debian) System : Linux 975cdb959a49 5.14.0-611.55.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 15:19:29 EDT 2026 x86_64 User : ( 501) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/html/wp-content/plugins/woocommerce/src/Internal/Orders/ |
Upload File : |
<?php
/**
* PointOfSaleOrderUtil class file.
*/
declare( strict_types = 1 );
namespace Automattic\WooCommerce\Internal\Orders;
use WC_Abstract_Order;
/**
* Helper class for POS order related functionality.
*
* @internal Just for internal use.
*/
class PointOfSaleOrderUtil {
/**
* Check if the order is a POS (Point of Sale) order.
*
* This method determines if an order was created via the POS REST API
* by checking the 'created_via' property of the order.
*
* @param WC_Abstract_Order $order Order instance.
* @return bool True if the order is a POS order, false otherwise.
*/
public static function is_pos_order( WC_Abstract_Order $order ): bool {
return 'pos-rest-api' === $order->get_created_via();
}
/**
* Check if the order was paid at POS, regardless of where it was created.
*
* An order is considered paid at POS if:
* - It was created via the POS REST API, OR
* - It was paid via card terminal, OR
* - It was paid via cash at POS.
*
* @param WC_Abstract_Order $order Order instance.
* @return bool
*
* @since 10.6.0
*/
public static function is_order_paid_at_pos( WC_Abstract_Order $order ): bool {
if ( self::is_pos_order( $order ) ) {
return true;
}
if ( 'mobile_pos' === $order->get_meta( '_wcpay_ipp_channel' ) ) {
return true;
}
if ( 'mobile_pos' === $order->get_meta( '_stripe_ipp_channel' ) ) {
return true;
}
if ( '' !== $order->get_meta( '_cash_change_amount' ) ) {
return true;
}
return false;
}
}