Automattic\WooCommerce\StoreApi\Schemas\V1
ShopperListItemSchema::get_properties │ public │ WC 1.0
Item schema properties.
Метод класса: ShopperListItemSchema{}
Хуков нет.
Возвращает
Массив.
Использование
$ShopperListItemSchema = new ShopperListItemSchema(); $ShopperListItemSchema->get_properties();
Код ShopperListItemSchema::get_properties() ShopperListItemSchema::get properties WC 11.0.1
public function get_properties() {
return array(
'key' => array(
'description' => __( 'Stable identifier for the saved item within its list.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'id' => array(
'description' => __( 'Variation ID if applicable, otherwise product ID.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'product_id' => array(
'description' => __( 'Product ID at the time the item was saved.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'variation_id' => array(
'description' => __( 'Variation ID at the time the item was saved, or 0 for non-variable products.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'quantity' => array(
'description' => __( 'Quantity of this saved item.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'is_live' => array(
'description' => __( 'True when the row serves live product data; false rows are at-save tombstones.', 'woocommerce' ),
'type' => 'boolean',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'is_purchasable' => array(
'description' => __( 'True when the product can be added to the cart.', 'woocommerce' ),
'type' => 'boolean',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'name' => array(
'description' => __( 'Product name. Live when is_live is true; falls back to the at-save title snapshot otherwise.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'permalink' => array(
'description' => __( 'Product URL. Null when the row is a tombstone (so iAPI strips the anchor href).', 'woocommerce' ),
'type' => array( 'string', 'null' ),
'format' => 'uri',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'images' => array(
'description' => __( 'List of images for the live product. Empty when the product no longer exists.', 'woocommerce' ),
'type' => 'array',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'items' => array(
'type' => 'object',
'properties' => $this->image_attachment_schema->get_properties(),
),
),
'variation' => array(
'description' => __( 'Chosen variation attributes, if applicable.', 'woocommerce' ),
'type' => 'array',
'context' => array( 'view', 'edit' ),
'readonly' => true,
'items' => array(
'type' => 'object',
'properties' => array(
'raw_attribute' => array(
'description' => __( 'Variation system generated attribute name.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'attribute' => array(
'description' => __( 'Variation attribute name.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'value' => array(
'description' => __( 'Variation attribute value.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
),
),
),
'prices' => array(
'description' => __( 'Live product prices. Omitted when the product no longer exists.', 'woocommerce' ),
'type' => array( 'object', 'null' ),
'context' => array( 'view', 'edit' ),
'readonly' => true,
'properties' => array_merge(
$this->get_store_currency_properties(),
array(
'price' => array(
'description' => __( 'Current product price.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'regular_price' => array(
'description' => __( 'Regular product price.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'sale_price' => array(
'description' => __( 'Sale product price, if applicable.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
)
),
),
'price_html' => array(
'description' => __( 'Live product price as HTML, formatted via wc_price including sale/discount markup. Empty when the product no longer exists.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'image_html' => array(
'description' => __( 'Product thumbnail as a fully-formed <img> element with srcset, sizes, alt, and lazy-loading attributes. Falls back to the configured placeholder image when the product has no image or no longer exists.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_added_gmt' => array(
'description' => __( 'The date the item was saved, as GMT.', 'woocommerce' ),
'type' => 'string',
'format' => 'date-time',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
);
}