__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Automattic\WooCommerce\StoreApi\Schemas\V1;
use Automattic\WooCommerce\StoreApi\Utilities\ProductItemTrait;
/**
* OrderItemSchema class.
*/
class OrderItemSchema extends ItemSchema {
use ProductItemTrait;
/**
* The schema item name.
*
* @var string
*/
protected $title = 'order_item';
/**
* The schema item identifier.
*
* @var string
*/
const IDENTIFIER = 'order-item';
/**
* Get order items data.
*
* @param \WC_Order_Item_Product $order_item Order item instance.
* @return array
*/
public function get_item_response( $order_item ) {
$order = $order_item->get_order();
$product = $order_item->get_product();
return [
'key' => $order->get_order_key(),
'id' => $order_item->get_id(),
'quantity' => $order_item->get_quantity(),
'quantity_limits' => array(
'minimum' => $order_item->get_quantity(),
'maximum' => $order_item->get_quantity(),
'multiple_of' => 1,
'editable' => false,
),
'name' => $order_item->get_name(),
'short_description' => $this->prepare_html_response( wc_format_content( wp_kses_post( $product->get_short_description() ) ) ),
'description' => $this->prepare_html_response( wc_format_content( wp_kses_post( $product->get_description() ) ) ),
'sku' => $this->prepare_html_response( $product->get_sku() ),
'low_stock_remaining' => null,
'backorders_allowed' => false,
'show_backorder_badge' => false,
'sold_individually' => $product->is_sold_individually(),
'permalink' => $product->get_permalink(),
'images' => $this->get_images( $product ),
'variation' => $this->format_variation_data( $product->get_attributes(), $product ),
'item_data' => $order_item->get_all_formatted_meta_data(),
'prices' => (object) $this->prepare_product_price_response( $product, get_option( 'woocommerce_tax_display_cart' ) ),
'totals' => (object) $this->prepare_currency_response( $this->get_totals( $order_item ) ),
'catalog_visibility' => $product->get_catalog_visibility(),
];
}
/**
* Get totals data.
*
* @param \WC_Order_Item_Product $order_item Order item instance.
* @return array
*/
public function get_totals( $order_item ) {
return [
'line_subtotal' => $this->prepare_money_response( $order_item->get_subtotal(), wc_get_price_decimals() ),
'line_subtotal_tax' => $this->prepare_money_response( $order_item->get_subtotal_tax(), wc_get_price_decimals() ),
'line_total' => $this->prepare_money_response( $order_item->get_total(), wc_get_price_decimals() ),
'line_total_tax' => $this->prepare_money_response( $order_item->get_total_tax(), wc_get_price_decimals() ),
];
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| AI | Folder | 0775 |
|
|
| Agentic | Folder | 0775 |
|
|
| AbstractAddressSchema.php | File | 10.58 KB | 0664 |
|
| AbstractSchema.php | File | 12.83 KB | 0664 |
|
| BatchSchema.php | File | 427 B | 0664 |
|
| BillingAddressSchema.php | File | 4.46 KB | 0664 |
|
| CartCouponSchema.php | File | 2.98 KB | 0664 |
|
| CartExtensionsSchema.php | File | 2.21 KB | 0664 |
|
| CartFeeSchema.php | File | 2.12 KB | 0664 |
|
| CartItemSchema.php | File | 7.55 KB | 0664 |
|
| CartSchema.php | File | 15.82 KB | 0664 |
|
| CartShippingRateSchema.php | File | 11.37 KB | 0664 |
|
| CheckoutOrderSchema.php | File | 752 B | 0664 |
|
| CheckoutSchema.php | File | 15.05 KB | 0664 |
|
| ErrorSchema.php | File | 1.12 KB | 0664 |
|
| ImageAttachmentSchema.php | File | 2.55 KB | 0664 |
|
| ItemSchema.php | File | 11.27 KB | 0664 |
|
| OrderCouponSchema.php | File | 2.41 KB | 0664 |
|
| OrderFeeSchema.php | File | 2.2 KB | 0664 |
|
| OrderItemSchema.php | File | 2.79 KB | 0664 |
|
| OrderSchema.php | File | 12.74 KB | 0664 |
|
| PatternsSchema.php | File | 673 B | 0664 |
|
| ProductAttributeSchema.php | File | 2.5 KB | 0664 |
|
| ProductBrandSchema.php | File | 3.49 KB | 0664 |
|
| ProductCategorySchema.php | File | 3.5 KB | 0664 |
|
| ProductCollectionDataSchema.php | File | 4.95 KB | 0664 |
|
| ProductReviewSchema.php | File | 6.12 KB | 0664 |
|
| ProductSchema.php | File | 32.79 KB | 0664 |
|
| ShippingAddressSchema.php | File | 2.84 KB | 0664 |
|
| TermSchema.php | File | 2.15 KB | 0664 |
|