| Conditions | 1 |
| Paths | 1 |
| Total Lines | 624 |
| Code Lines | 493 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 49 | public function get_item_schema() { |
||
| 50 | $weight_unit = get_option( 'woocommerce_weight_unit' ); |
||
| 51 | $dimension_unit = get_option( 'woocommerce_dimension_unit' ); |
||
| 52 | $schema = array( |
||
| 53 | '$schema' => 'http://json-schema.org/draft-04/schema#', |
||
| 54 | 'title' => 'product', |
||
| 55 | 'type' => 'object', |
||
| 56 | 'properties' => array( |
||
| 57 | 'id' => array( |
||
| 58 | 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), |
||
| 59 | 'type' => 'integer', |
||
| 60 | 'context' => array( 'view', 'edit', 'embed' ), |
||
| 61 | 'readonly' => true, |
||
| 62 | ), |
||
| 63 | 'name' => array( |
||
| 64 | 'description' => __( 'Product name.', 'woocommerce-rest-api' ), |
||
| 65 | 'type' => 'string', |
||
| 66 | 'context' => array( 'view', 'edit', 'embed' ), |
||
| 67 | 'arg_options' => array( |
||
| 68 | 'sanitize_callback' => 'wp_filter_post_kses', |
||
| 69 | ), |
||
| 70 | ), |
||
| 71 | 'slug' => array( |
||
| 72 | 'description' => __( 'Product slug.', 'woocommerce-rest-api' ), |
||
| 73 | 'type' => 'string', |
||
| 74 | 'context' => array( 'view', 'edit', 'embed' ), |
||
| 75 | ), |
||
| 76 | 'permalink' => array( |
||
| 77 | 'description' => __( 'Product URL.', 'woocommerce-rest-api' ), |
||
| 78 | 'type' => 'string', |
||
| 79 | 'format' => 'uri', |
||
| 80 | 'context' => array( 'view', 'edit', 'embed' ), |
||
| 81 | 'readonly' => true, |
||
| 82 | ), |
||
| 83 | 'date_created' => array( |
||
| 84 | 'description' => __( "The date the product was created, in the site's timezone.", 'woocommerce-rest-api' ), |
||
| 85 | 'type' => 'date-time', |
||
| 86 | 'context' => array( 'view', 'edit' ), |
||
| 87 | ), |
||
| 88 | 'date_created_gmt' => array( |
||
| 89 | 'description' => __( 'The date the product was created, as GMT.', 'woocommerce-rest-api' ), |
||
| 90 | 'type' => 'date-time', |
||
| 91 | 'context' => array( 'view', 'edit' ), |
||
| 92 | ), |
||
| 93 | 'date_modified' => array( |
||
| 94 | 'description' => __( "The date the product was last modified, in the site's timezone.", 'woocommerce-rest-api' ), |
||
| 95 | 'type' => 'date-time', |
||
| 96 | 'context' => array( 'view', 'edit' ), |
||
| 97 | 'readonly' => true, |
||
| 98 | ), |
||
| 99 | 'date_modified_gmt' => array( |
||
| 100 | 'description' => __( 'The date the product was last modified, as GMT.', 'woocommerce-rest-api' ), |
||
| 101 | 'type' => 'date-time', |
||
| 102 | 'context' => array( 'view', 'edit' ), |
||
| 103 | 'readonly' => true, |
||
| 104 | ), |
||
| 105 | 'type' => array( |
||
| 106 | 'description' => __( 'Product type.', 'woocommerce-rest-api' ), |
||
| 107 | 'type' => 'string', |
||
| 108 | 'default' => 'simple', |
||
| 109 | 'enum' => array_keys( wc_get_product_types() ), |
||
| 110 | 'context' => array( 'view', 'edit' ), |
||
| 111 | ), |
||
| 112 | 'status' => array( |
||
| 113 | 'description' => __( 'Product status (post status).', 'woocommerce-rest-api' ), |
||
| 114 | 'type' => 'string', |
||
| 115 | 'default' => 'publish', |
||
| 116 | 'enum' => array_merge( array_keys( get_post_statuses() ), array( 'future' ) ), |
||
| 117 | 'context' => array( 'view', 'edit' ), |
||
| 118 | ), |
||
| 119 | 'featured' => array( |
||
| 120 | 'description' => __( 'Featured product.', 'woocommerce-rest-api' ), |
||
| 121 | 'type' => 'boolean', |
||
| 122 | 'default' => false, |
||
| 123 | 'context' => array( 'view', 'edit' ), |
||
| 124 | ), |
||
| 125 | 'catalog_visibility' => array( |
||
| 126 | 'description' => __( 'Catalog visibility.', 'woocommerce-rest-api' ), |
||
| 127 | 'type' => 'string', |
||
| 128 | 'default' => 'visible', |
||
| 129 | 'enum' => array( 'visible', 'catalog', 'search', 'hidden' ), |
||
| 130 | 'context' => array( 'view', 'edit' ), |
||
| 131 | ), |
||
| 132 | 'description' => array( |
||
| 133 | 'description' => __( 'Product description.', 'woocommerce-rest-api' ), |
||
| 134 | 'type' => 'string', |
||
| 135 | 'context' => array( 'view', 'edit', 'embed' ), |
||
| 136 | 'arg_options' => array( |
||
| 137 | 'sanitize_callback' => 'wp_filter_post_kses', |
||
| 138 | ), |
||
| 139 | ), |
||
| 140 | 'short_description' => array( |
||
| 141 | 'description' => __( 'Product short description.', 'woocommerce-rest-api' ), |
||
| 142 | 'type' => 'string', |
||
| 143 | 'context' => array( 'view', 'edit', 'embed' ), |
||
| 144 | 'arg_options' => array( |
||
| 145 | 'sanitize_callback' => 'wp_filter_post_kses', |
||
| 146 | ), |
||
| 147 | ), |
||
| 148 | 'sku' => array( |
||
| 149 | 'description' => __( 'Unique identifier.', 'woocommerce-rest-api' ), |
||
| 150 | 'type' => 'string', |
||
| 151 | 'context' => array( 'view', 'edit' ), |
||
| 152 | 'arg_options' => array( |
||
| 153 | 'sanitize_callback' => 'wc_clean', |
||
| 154 | ), |
||
| 155 | ), |
||
| 156 | 'price' => array( |
||
| 157 | 'description' => __( 'Current product price.', 'woocommerce-rest-api' ), |
||
| 158 | 'type' => 'string', |
||
| 159 | 'context' => array( 'view', 'edit' ), |
||
| 160 | 'readonly' => true, |
||
| 161 | ), |
||
| 162 | 'regular_price' => array( |
||
| 163 | 'description' => __( 'Product regular price.', 'woocommerce-rest-api' ), |
||
| 164 | 'type' => 'string', |
||
| 165 | 'context' => array( 'view', 'edit' ), |
||
| 166 | ), |
||
| 167 | 'sale_price' => array( |
||
| 168 | 'description' => __( 'Product sale price.', 'woocommerce-rest-api' ), |
||
| 169 | 'type' => 'string', |
||
| 170 | 'context' => array( 'view', 'edit' ), |
||
| 171 | ), |
||
| 172 | 'date_on_sale_from' => array( |
||
| 173 | 'description' => __( "Start date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), |
||
| 174 | 'type' => 'date-time', |
||
| 175 | 'context' => array( 'view', 'edit' ), |
||
| 176 | ), |
||
| 177 | 'date_on_sale_from_gmt' => array( |
||
| 178 | 'description' => __( 'Start date of sale price, as GMT.', 'woocommerce-rest-api' ), |
||
| 179 | 'type' => 'date-time', |
||
| 180 | 'context' => array( 'view', 'edit' ), |
||
| 181 | ), |
||
| 182 | 'date_on_sale_to' => array( |
||
| 183 | 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), |
||
| 184 | 'type' => 'date-time', |
||
| 185 | 'context' => array( 'view', 'edit' ), |
||
| 186 | ), |
||
| 187 | 'date_on_sale_to_gmt' => array( |
||
| 188 | 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), |
||
| 189 | 'type' => 'date-time', |
||
| 190 | 'context' => array( 'view', 'edit' ), |
||
| 191 | ), |
||
| 192 | 'price_html' => array( |
||
| 193 | 'description' => __( 'Price formatted in HTML.', 'woocommerce-rest-api' ), |
||
| 194 | 'type' => 'string', |
||
| 195 | 'context' => array( 'view', 'edit' ), |
||
| 196 | 'readonly' => true, |
||
| 197 | ), |
||
| 198 | 'on_sale' => array( |
||
| 199 | 'description' => __( 'Shows if the product is on sale.', 'woocommerce-rest-api' ), |
||
| 200 | 'type' => 'boolean', |
||
| 201 | 'context' => array( 'view', 'edit' ), |
||
| 202 | 'readonly' => true, |
||
| 203 | ), |
||
| 204 | 'purchasable' => array( |
||
| 205 | 'description' => __( 'Shows if the product can be bought.', 'woocommerce-rest-api' ), |
||
| 206 | 'type' => 'boolean', |
||
| 207 | 'context' => array( 'view', 'edit' ), |
||
| 208 | 'readonly' => true, |
||
| 209 | ), |
||
| 210 | 'total_sales' => array( |
||
| 211 | 'description' => __( 'Amount of sales.', 'woocommerce-rest-api' ), |
||
| 212 | 'type' => 'integer', |
||
| 213 | 'context' => array( 'view', 'edit' ), |
||
| 214 | 'readonly' => true, |
||
| 215 | ), |
||
| 216 | 'virtual' => array( |
||
| 217 | 'description' => __( 'If the product is virtual.', 'woocommerce-rest-api' ), |
||
| 218 | 'type' => 'boolean', |
||
| 219 | 'default' => false, |
||
| 220 | 'context' => array( 'view', 'edit' ), |
||
| 221 | ), |
||
| 222 | 'downloadable' => array( |
||
| 223 | 'description' => __( 'If the product is downloadable.', 'woocommerce-rest-api' ), |
||
| 224 | 'type' => 'boolean', |
||
| 225 | 'default' => false, |
||
| 226 | 'context' => array( 'view', 'edit' ), |
||
| 227 | ), |
||
| 228 | 'downloads' => array( |
||
| 229 | 'description' => __( 'List of downloadable files.', 'woocommerce-rest-api' ), |
||
| 230 | 'type' => 'array', |
||
| 231 | 'context' => array( 'view', 'edit' ), |
||
| 232 | 'items' => array( |
||
| 233 | 'type' => 'object', |
||
| 234 | 'properties' => array( |
||
| 235 | 'id' => array( |
||
| 236 | 'description' => __( 'File ID.', 'woocommerce-rest-api' ), |
||
| 237 | 'type' => 'string', |
||
| 238 | 'context' => array( 'view', 'edit' ), |
||
| 239 | ), |
||
| 240 | 'name' => array( |
||
| 241 | 'description' => __( 'File name.', 'woocommerce-rest-api' ), |
||
| 242 | 'type' => 'string', |
||
| 243 | 'context' => array( 'view', 'edit' ), |
||
| 244 | ), |
||
| 245 | 'file' => array( |
||
| 246 | 'description' => __( 'File URL.', 'woocommerce-rest-api' ), |
||
| 247 | 'type' => 'string', |
||
| 248 | 'context' => array( 'view', 'edit' ), |
||
| 249 | ), |
||
| 250 | ), |
||
| 251 | ), |
||
| 252 | ), |
||
| 253 | 'download_limit' => array( |
||
| 254 | 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce-rest-api' ), |
||
| 255 | 'type' => 'integer', |
||
| 256 | 'default' => -1, |
||
| 257 | 'context' => array( 'view', 'edit' ), |
||
| 258 | ), |
||
| 259 | 'download_expiry' => array( |
||
| 260 | 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce-rest-api' ), |
||
| 261 | 'type' => 'integer', |
||
| 262 | 'default' => -1, |
||
| 263 | 'context' => array( 'view', 'edit' ), |
||
| 264 | ), |
||
| 265 | 'external_url' => array( |
||
| 266 | 'description' => __( 'Product external URL. Only for external products.', 'woocommerce-rest-api' ), |
||
| 267 | 'type' => 'string', |
||
| 268 | 'format' => 'uri', |
||
| 269 | 'context' => array( 'view', 'edit' ), |
||
| 270 | ), |
||
| 271 | 'button_text' => array( |
||
| 272 | 'description' => __( 'Product external button text. Only for external products.', 'woocommerce-rest-api' ), |
||
| 273 | 'type' => 'string', |
||
| 274 | 'context' => array( 'view', 'edit' ), |
||
| 275 | ), |
||
| 276 | 'tax_status' => array( |
||
| 277 | 'description' => __( 'Tax status.', 'woocommerce-rest-api' ), |
||
| 278 | 'type' => 'string', |
||
| 279 | 'default' => 'taxable', |
||
| 280 | 'enum' => array( 'taxable', 'shipping', 'none' ), |
||
| 281 | 'context' => array( 'view', 'edit' ), |
||
| 282 | ), |
||
| 283 | 'tax_class' => array( |
||
| 284 | 'description' => __( 'Tax class.', 'woocommerce-rest-api' ), |
||
| 285 | 'type' => 'string', |
||
| 286 | 'context' => array( 'view', 'edit' ), |
||
| 287 | ), |
||
| 288 | 'manage_stock' => array( |
||
| 289 | 'description' => __( 'Stock management at product level.', 'woocommerce-rest-api' ), |
||
| 290 | 'type' => 'boolean', |
||
| 291 | 'default' => false, |
||
| 292 | 'context' => array( 'view', 'edit' ), |
||
| 293 | ), |
||
| 294 | 'stock_quantity' => array( |
||
| 295 | 'description' => __( 'Stock quantity.', 'woocommerce-rest-api' ), |
||
| 296 | 'type' => 'integer', |
||
| 297 | 'context' => array( 'view', 'edit' ), |
||
| 298 | ), |
||
| 299 | 'stock_status' => array( |
||
| 300 | 'description' => __( 'Controls the stock status of the product.', 'woocommerce-rest-api' ), |
||
| 301 | 'type' => 'string', |
||
| 302 | 'default' => 'instock', |
||
| 303 | 'enum' => array_keys( wc_get_product_stock_status_options() ), |
||
| 304 | 'context' => array( 'view', 'edit' ), |
||
| 305 | ), |
||
| 306 | 'backorders' => array( |
||
| 307 | 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce-rest-api' ), |
||
| 308 | 'type' => 'string', |
||
| 309 | 'default' => 'no', |
||
| 310 | 'enum' => array( 'no', 'notify', 'yes' ), |
||
| 311 | 'context' => array( 'view', 'edit' ), |
||
| 312 | ), |
||
| 313 | 'backorders_allowed' => array( |
||
| 314 | 'description' => __( 'Shows if backorders are allowed.', 'woocommerce-rest-api' ), |
||
| 315 | 'type' => 'boolean', |
||
| 316 | 'context' => array( 'view', 'edit' ), |
||
| 317 | 'readonly' => true, |
||
| 318 | ), |
||
| 319 | 'backordered' => array( |
||
| 320 | 'description' => __( 'Shows if the product is on backordered.', 'woocommerce-rest-api' ), |
||
| 321 | 'type' => 'boolean', |
||
| 322 | 'context' => array( 'view', 'edit' ), |
||
| 323 | 'readonly' => true, |
||
| 324 | ), |
||
| 325 | 'sold_individually' => array( |
||
| 326 | 'description' => __( 'Allow one item to be bought in a single order.', 'woocommerce-rest-api' ), |
||
| 327 | 'type' => 'boolean', |
||
| 328 | 'default' => false, |
||
| 329 | 'context' => array( 'view', 'edit' ), |
||
| 330 | ), |
||
| 331 | 'weight' => array( |
||
| 332 | /* translators: %s: weight unit */ |
||
| 333 | 'description' => sprintf( __( 'Product weight (%s).', 'woocommerce-rest-api' ), $weight_unit ), |
||
|
|
|||
| 334 | 'type' => 'string', |
||
| 335 | 'context' => array( 'view', 'edit' ), |
||
| 336 | ), |
||
| 337 | 'dimensions' => array( |
||
| 338 | 'description' => __( 'Product dimensions.', 'woocommerce-rest-api' ), |
||
| 339 | 'type' => 'object', |
||
| 340 | 'context' => array( 'view', 'edit' ), |
||
| 341 | 'properties' => array( |
||
| 342 | 'length' => array( |
||
| 343 | /* translators: %s: dimension unit */ |
||
| 344 | 'description' => sprintf( __( 'Product length (%s).', 'woocommerce-rest-api' ), $dimension_unit ), |
||
| 345 | 'type' => 'string', |
||
| 346 | 'context' => array( 'view', 'edit' ), |
||
| 347 | ), |
||
| 348 | 'width' => array( |
||
| 349 | /* translators: %s: dimension unit */ |
||
| 350 | 'description' => sprintf( __( 'Product width (%s).', 'woocommerce-rest-api' ), $dimension_unit ), |
||
| 351 | 'type' => 'string', |
||
| 352 | 'context' => array( 'view', 'edit' ), |
||
| 353 | ), |
||
| 354 | 'height' => array( |
||
| 355 | /* translators: %s: dimension unit */ |
||
| 356 | 'description' => sprintf( __( 'Product height (%s).', 'woocommerce-rest-api' ), $dimension_unit ), |
||
| 357 | 'type' => 'string', |
||
| 358 | 'context' => array( 'view', 'edit' ), |
||
| 359 | ), |
||
| 360 | ), |
||
| 361 | ), |
||
| 362 | 'shipping_required' => array( |
||
| 363 | 'description' => __( 'Shows if the product need to be shipped.', 'woocommerce-rest-api' ), |
||
| 364 | 'type' => 'boolean', |
||
| 365 | 'context' => array( 'view', 'edit' ), |
||
| 366 | 'readonly' => true, |
||
| 367 | ), |
||
| 368 | 'shipping_taxable' => array( |
||
| 369 | 'description' => __( 'Shows whether or not the product shipping is taxable.', 'woocommerce-rest-api' ), |
||
| 370 | 'type' => 'boolean', |
||
| 371 | 'context' => array( 'view', 'edit' ), |
||
| 372 | 'readonly' => true, |
||
| 373 | ), |
||
| 374 | 'shipping_class' => array( |
||
| 375 | 'description' => __( 'Shipping class slug.', 'woocommerce-rest-api' ), |
||
| 376 | 'type' => 'string', |
||
| 377 | 'context' => array( 'view', 'edit' ), |
||
| 378 | ), |
||
| 379 | 'shipping_class_id' => array( |
||
| 380 | 'description' => __( 'Shipping class ID.', 'woocommerce-rest-api' ), |
||
| 381 | 'type' => 'string', |
||
| 382 | 'context' => array( 'view', 'edit' ), |
||
| 383 | 'readonly' => true, |
||
| 384 | ), |
||
| 385 | 'reviews_allowed' => array( |
||
| 386 | 'description' => __( 'Allow reviews.', 'woocommerce-rest-api' ), |
||
| 387 | 'type' => 'boolean', |
||
| 388 | 'default' => true, |
||
| 389 | 'context' => array( 'view', 'edit' ), |
||
| 390 | ), |
||
| 391 | 'average_rating' => array( |
||
| 392 | 'description' => __( 'Reviews average rating.', 'woocommerce-rest-api' ), |
||
| 393 | 'type' => 'string', |
||
| 394 | 'context' => array( 'view', 'edit' ), |
||
| 395 | 'readonly' => true, |
||
| 396 | ), |
||
| 397 | 'rating_count' => array( |
||
| 398 | 'description' => __( 'Amount of reviews that the product have.', 'woocommerce-rest-api' ), |
||
| 399 | 'type' => 'integer', |
||
| 400 | 'context' => array( 'view', 'edit' ), |
||
| 401 | 'readonly' => true, |
||
| 402 | ), |
||
| 403 | 'related_ids' => array( |
||
| 404 | 'description' => __( 'List of related products IDs.', 'woocommerce-rest-api' ), |
||
| 405 | 'type' => 'array', |
||
| 406 | 'items' => array( |
||
| 407 | 'type' => 'integer', |
||
| 408 | ), |
||
| 409 | 'context' => array( 'view', 'edit' ), |
||
| 410 | 'readonly' => true, |
||
| 411 | ), |
||
| 412 | 'upsell_ids' => array( |
||
| 413 | 'description' => __( 'List of up-sell products IDs.', 'woocommerce-rest-api' ), |
||
| 414 | 'type' => 'array', |
||
| 415 | 'items' => array( |
||
| 416 | 'type' => 'integer', |
||
| 417 | ), |
||
| 418 | 'context' => array( 'view', 'edit' ), |
||
| 419 | ), |
||
| 420 | 'cross_sell_ids' => array( |
||
| 421 | 'description' => __( 'List of cross-sell products IDs.', 'woocommerce-rest-api' ), |
||
| 422 | 'type' => 'array', |
||
| 423 | 'items' => array( |
||
| 424 | 'type' => 'integer', |
||
| 425 | ), |
||
| 426 | 'context' => array( 'view', 'edit' ), |
||
| 427 | ), |
||
| 428 | 'parent_id' => array( |
||
| 429 | 'description' => __( 'Product parent ID.', 'woocommerce-rest-api' ), |
||
| 430 | 'type' => 'integer', |
||
| 431 | 'context' => array( 'view', 'edit' ), |
||
| 432 | ), |
||
| 433 | 'purchase_note' => array( |
||
| 434 | 'description' => __( 'Optional note to send the customer after purchase.', 'woocommerce-rest-api' ), |
||
| 435 | 'type' => 'string', |
||
| 436 | 'context' => array( 'view', 'edit' ), |
||
| 437 | 'arg_options' => array( |
||
| 438 | 'sanitize_callback' => 'wp_kses_post', |
||
| 439 | ), |
||
| 440 | ), |
||
| 441 | 'categories' => array( |
||
| 442 | 'description' => __( 'List of categories.', 'woocommerce-rest-api' ), |
||
| 443 | 'type' => 'array', |
||
| 444 | 'context' => array( 'view', 'edit' ), |
||
| 445 | 'items' => array( |
||
| 446 | 'type' => 'object', |
||
| 447 | 'properties' => array( |
||
| 448 | 'id' => array( |
||
| 449 | 'description' => __( 'Category ID.', 'woocommerce-rest-api' ), |
||
| 450 | 'type' => 'integer', |
||
| 451 | 'context' => array( 'view', 'edit' ), |
||
| 452 | ), |
||
| 453 | 'name' => array( |
||
| 454 | 'description' => __( 'Category name.', 'woocommerce-rest-api' ), |
||
| 455 | 'type' => 'string', |
||
| 456 | 'context' => array( 'view', 'edit' ), |
||
| 457 | 'readonly' => true, |
||
| 458 | ), |
||
| 459 | 'slug' => array( |
||
| 460 | 'description' => __( 'Category slug.', 'woocommerce-rest-api' ), |
||
| 461 | 'type' => 'string', |
||
| 462 | 'context' => array( 'view', 'edit' ), |
||
| 463 | 'readonly' => true, |
||
| 464 | ), |
||
| 465 | ), |
||
| 466 | ), |
||
| 467 | ), |
||
| 468 | 'tags' => array( |
||
| 469 | 'description' => __( 'List of tags.', 'woocommerce-rest-api' ), |
||
| 470 | 'type' => 'array', |
||
| 471 | 'context' => array( 'view', 'edit' ), |
||
| 472 | 'items' => array( |
||
| 473 | 'type' => 'object', |
||
| 474 | 'properties' => array( |
||
| 475 | 'id' => array( |
||
| 476 | 'description' => __( 'Tag ID.', 'woocommerce-rest-api' ), |
||
| 477 | 'type' => 'integer', |
||
| 478 | 'context' => array( 'view', 'edit' ), |
||
| 479 | ), |
||
| 480 | 'name' => array( |
||
| 481 | 'description' => __( 'Tag name.', 'woocommerce-rest-api' ), |
||
| 482 | 'type' => 'string', |
||
| 483 | 'context' => array( 'view', 'edit' ), |
||
| 484 | 'readonly' => true, |
||
| 485 | ), |
||
| 486 | 'slug' => array( |
||
| 487 | 'description' => __( 'Tag slug.', 'woocommerce-rest-api' ), |
||
| 488 | 'type' => 'string', |
||
| 489 | 'context' => array( 'view', 'edit' ), |
||
| 490 | 'readonly' => true, |
||
| 491 | ), |
||
| 492 | ), |
||
| 493 | ), |
||
| 494 | ), |
||
| 495 | 'images' => array( |
||
| 496 | 'description' => __( 'List of images.', 'woocommerce-rest-api' ), |
||
| 497 | 'type' => 'object', |
||
| 498 | 'context' => array( 'view', 'edit', 'embed' ), |
||
| 499 | 'items' => array( |
||
| 500 | 'type' => 'object', |
||
| 501 | 'properties' => array( |
||
| 502 | 'id' => array( |
||
| 503 | 'description' => __( 'Image ID.', 'woocommerce-rest-api' ), |
||
| 504 | 'type' => 'integer', |
||
| 505 | 'context' => array( 'view', 'edit' ), |
||
| 506 | ), |
||
| 507 | 'date_created' => array( |
||
| 508 | 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce-rest-api' ), |
||
| 509 | 'type' => 'date-time', |
||
| 510 | 'context' => array( 'view', 'edit' ), |
||
| 511 | 'readonly' => true, |
||
| 512 | ), |
||
| 513 | 'date_created_gmt' => array( |
||
| 514 | 'description' => __( 'The date the image was created, as GMT.', 'woocommerce-rest-api' ), |
||
| 515 | 'type' => 'date-time', |
||
| 516 | 'context' => array( 'view', 'edit' ), |
||
| 517 | 'readonly' => true, |
||
| 518 | ), |
||
| 519 | 'date_modified' => array( |
||
| 520 | 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce-rest-api' ), |
||
| 521 | 'type' => 'date-time', |
||
| 522 | 'context' => array( 'view', 'edit' ), |
||
| 523 | 'readonly' => true, |
||
| 524 | ), |
||
| 525 | 'date_modified_gmt' => array( |
||
| 526 | 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce-rest-api' ), |
||
| 527 | 'type' => 'date-time', |
||
| 528 | 'context' => array( 'view', 'edit' ), |
||
| 529 | 'readonly' => true, |
||
| 530 | ), |
||
| 531 | 'src' => array( |
||
| 532 | 'description' => __( 'Image URL.', 'woocommerce-rest-api' ), |
||
| 533 | 'type' => 'string', |
||
| 534 | 'format' => 'uri', |
||
| 535 | 'context' => array( 'view', 'edit' ), |
||
| 536 | ), |
||
| 537 | 'name' => array( |
||
| 538 | 'description' => __( 'Image name.', 'woocommerce-rest-api' ), |
||
| 539 | 'type' => 'string', |
||
| 540 | 'context' => array( 'view', 'edit' ), |
||
| 541 | ), |
||
| 542 | 'alt' => array( |
||
| 543 | 'description' => __( 'Image alternative text.', 'woocommerce-rest-api' ), |
||
| 544 | 'type' => 'string', |
||
| 545 | 'context' => array( 'view', 'edit' ), |
||
| 546 | ), |
||
| 547 | ), |
||
| 548 | ), |
||
| 549 | ), |
||
| 550 | 'attributes' => array( |
||
| 551 | 'description' => __( 'List of attributes.', 'woocommerce-rest-api' ), |
||
| 552 | 'type' => 'array', |
||
| 553 | 'context' => array( 'view', 'edit' ), |
||
| 554 | 'items' => array( |
||
| 555 | 'type' => 'object', |
||
| 556 | 'properties' => array( |
||
| 557 | 'id' => array( |
||
| 558 | 'description' => __( 'Attribute ID.', 'woocommerce-rest-api' ), |
||
| 559 | 'type' => 'integer', |
||
| 560 | 'context' => array( 'view', 'edit' ), |
||
| 561 | ), |
||
| 562 | 'name' => array( |
||
| 563 | 'description' => __( 'Attribute name.', 'woocommerce-rest-api' ), |
||
| 564 | 'type' => 'string', |
||
| 565 | 'context' => array( 'view', 'edit' ), |
||
| 566 | ), |
||
| 567 | 'position' => array( |
||
| 568 | 'description' => __( 'Attribute position.', 'woocommerce-rest-api' ), |
||
| 569 | 'type' => 'integer', |
||
| 570 | 'context' => array( 'view', 'edit' ), |
||
| 571 | ), |
||
| 572 | 'visible' => array( |
||
| 573 | 'description' => __( "Define if the attribute is visible on the \"Additional information\" tab in the product's page.", 'woocommerce-rest-api' ), |
||
| 574 | 'type' => 'boolean', |
||
| 575 | 'default' => false, |
||
| 576 | 'context' => array( 'view', 'edit' ), |
||
| 577 | ), |
||
| 578 | 'variation' => array( |
||
| 579 | 'description' => __( 'Define if the attribute can be used as variation.', 'woocommerce-rest-api' ), |
||
| 580 | 'type' => 'boolean', |
||
| 581 | 'default' => false, |
||
| 582 | 'context' => array( 'view', 'edit' ), |
||
| 583 | ), |
||
| 584 | 'options' => array( |
||
| 585 | 'description' => __( 'List of available term names of the attribute.', 'woocommerce-rest-api' ), |
||
| 586 | 'type' => 'array', |
||
| 587 | 'items' => array( |
||
| 588 | 'type' => 'string', |
||
| 589 | ), |
||
| 590 | 'context' => array( 'view', 'edit' ), |
||
| 591 | ), |
||
| 592 | ), |
||
| 593 | ), |
||
| 594 | ), |
||
| 595 | 'default_attributes' => array( |
||
| 596 | 'description' => __( 'Defaults variation attributes.', 'woocommerce-rest-api' ), |
||
| 597 | 'type' => 'array', |
||
| 598 | 'context' => array( 'view', 'edit' ), |
||
| 599 | 'items' => array( |
||
| 600 | 'type' => 'object', |
||
| 601 | 'properties' => array( |
||
| 602 | 'id' => array( |
||
| 603 | 'description' => __( 'Attribute ID.', 'woocommerce-rest-api' ), |
||
| 604 | 'type' => 'integer', |
||
| 605 | 'context' => array( 'view', 'edit' ), |
||
| 606 | ), |
||
| 607 | 'name' => array( |
||
| 608 | 'description' => __( 'Attribute name.', 'woocommerce-rest-api' ), |
||
| 609 | 'type' => 'string', |
||
| 610 | 'context' => array( 'view', 'edit' ), |
||
| 611 | ), |
||
| 612 | 'option' => array( |
||
| 613 | 'description' => __( 'Selected attribute term name.', 'woocommerce-rest-api' ), |
||
| 614 | 'type' => 'string', |
||
| 615 | 'context' => array( 'view', 'edit' ), |
||
| 616 | ), |
||
| 617 | ), |
||
| 618 | ), |
||
| 619 | ), |
||
| 620 | 'variations' => array( |
||
| 621 | 'description' => __( 'List of variations IDs.', 'woocommerce-rest-api' ), |
||
| 622 | 'type' => 'array', |
||
| 623 | 'context' => array( 'view', 'edit' ), |
||
| 624 | 'items' => array( |
||
| 625 | 'type' => 'integer', |
||
| 626 | ), |
||
| 627 | 'readonly' => true, |
||
| 628 | ), |
||
| 629 | 'grouped_products' => array( |
||
| 630 | 'description' => __( 'List of grouped products ID.', 'woocommerce-rest-api' ), |
||
| 631 | 'type' => 'array', |
||
| 632 | 'items' => array( |
||
| 633 | 'type' => 'integer', |
||
| 634 | ), |
||
| 635 | 'context' => array( 'view', 'edit' ), |
||
| 636 | 'readonly' => true, |
||
| 637 | ), |
||
| 638 | 'menu_order' => array( |
||
| 639 | 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce-rest-api' ), |
||
| 640 | 'type' => 'integer', |
||
| 641 | 'context' => array( 'view', 'edit' ), |
||
| 642 | ), |
||
| 643 | 'meta_data' => array( |
||
| 644 | 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), |
||
| 645 | 'type' => 'array', |
||
| 646 | 'context' => array( 'view', 'edit' ), |
||
| 647 | 'items' => array( |
||
| 648 | 'type' => 'object', |
||
| 649 | 'properties' => array( |
||
| 650 | 'id' => array( |
||
| 651 | 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), |
||
| 652 | 'type' => 'integer', |
||
| 653 | 'context' => array( 'view', 'edit' ), |
||
| 654 | 'readonly' => true, |
||
| 655 | ), |
||
| 656 | 'key' => array( |
||
| 657 | 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), |
||
| 658 | 'type' => 'string', |
||
| 659 | 'context' => array( 'view', 'edit' ), |
||
| 660 | ), |
||
| 661 | 'value' => array( |
||
| 662 | 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), |
||
| 663 | 'type' => 'mixed', |
||
| 664 | 'context' => array( 'view', 'edit' ), |
||
| 665 | ), |
||
| 666 | ), |
||
| 667 | ), |
||
| 668 | ), |
||
| 669 | ), |
||
| 670 | ); |
||
| 671 | |||
| 672 | return $this->add_additional_fields_schema( $schema ); |
||
| 673 | } |
||
| 1228 |