update woo-gutenberg-products-block text domain to woocommerce in src folder (#42718)
Co-authored-by: Ron Rennick <ronald.rennick@automattic.com>
This commit is contained in:
parent
60b445510d
commit
d1498d45f2
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: update
|
||||
|
||||
update woo-gutenberg-products-block text domain to woocommerce in src folder
|
|
@ -42,7 +42,7 @@ class Connection {
|
|||
);
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return new \WP_Error( $response->get_error_code(), esc_html__( 'Failed to connect with the AI endpoint: try again later.', 'woo-gutenberg-products-block' ), $response->get_error_message() );
|
||||
return new \WP_Error( $response->get_error_code(), esc_html__( 'Failed to connect with the AI endpoint: try again later.', 'woocommerce' ), $response->get_error_message() );
|
||||
}
|
||||
|
||||
$body = wp_remote_retrieve_body( $response );
|
||||
|
@ -86,7 +86,7 @@ class Connection {
|
|||
|
||||
foreach ( $responses as $key => $response ) {
|
||||
if ( is_wp_error( $response ) || is_a( $response, Exception::class ) ) {
|
||||
return new WP_Error( 'failed-to-connect-with-the-ai-endpoint', esc_html__( 'Failed to connect with the AI endpoint: try again later.', 'woo-gutenberg-products-block' ) );
|
||||
return new WP_Error( 'failed-to-connect-with-the-ai-endpoint', esc_html__( 'Failed to connect with the AI endpoint: try again later.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$processed_responses[ $key ] = json_decode( $response->body, true );
|
||||
|
@ -102,13 +102,13 @@ class Connection {
|
|||
*/
|
||||
public function get_site_id() {
|
||||
if ( ! class_exists( Jetpack_Options::class ) ) {
|
||||
return new \WP_Error( 'site-id-error', esc_html__( 'Failed to fetch the site ID: try again later.', 'woo-gutenberg-products-block' ) );
|
||||
return new \WP_Error( 'site-id-error', esc_html__( 'Failed to fetch the site ID: try again later.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$site_id = Jetpack_Options::get_option( 'id' );
|
||||
|
||||
if ( ! $site_id ) {
|
||||
return new \WP_Error( 'site-id-error', esc_html__( 'Failed to fetch the site ID: The site is not registered.', 'woo-gutenberg-products-block' ) );
|
||||
return new \WP_Error( 'site-id-error', esc_html__( 'Failed to fetch the site ID: The site is not registered.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
return $site_id;
|
||||
|
@ -138,11 +138,11 @@ class Connection {
|
|||
$response = json_decode( wp_remote_retrieve_body( $request ) );
|
||||
|
||||
if ( $response instanceof \WP_Error ) {
|
||||
return new \WP_Error( $response->get_error_code(), esc_html__( 'Failed to generate the JWT token', 'woo-gutenberg-products-block' ), $response->get_error_message() );
|
||||
return new \WP_Error( $response->get_error_code(), esc_html__( 'Failed to generate the JWT token', 'woocommerce' ), $response->get_error_message() );
|
||||
}
|
||||
|
||||
if ( ! isset( $response->token ) ) {
|
||||
return new \WP_Error( 'failed-to-retrieve-jwt-token', esc_html__( 'Failed to retrieve the JWT token: Try again later.', 'woo-gutenberg-products-block' ) );
|
||||
return new \WP_Error( 'failed-to-retrieve-jwt-token', esc_html__( 'Failed to retrieve the JWT token: Try again later.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
return $response->token;
|
||||
|
|
|
@ -243,7 +243,7 @@ class Api {
|
|||
function() use ( $handle ) {
|
||||
echo '<div class="error"><p>';
|
||||
/* translators: %s file handle name. */
|
||||
printf( esc_html__( 'Script with handle %s had a dependency on itself which has been removed. This is an indicator that your JS code has a circular dependency that can cause bugs.', 'woo-gutenberg-products-block' ), esc_html( $handle ) );
|
||||
printf( esc_html__( 'Script with handle %s had a dependency on itself which has been removed. This is an indicator that your JS code has a circular dependency that can cause bugs.', 'woocommerce' ), esc_html( $handle ) );
|
||||
echo '</p></div>';
|
||||
}
|
||||
);
|
||||
|
@ -266,7 +266,7 @@ class Api {
|
|||
wp_register_script( $handle, $script_data['src'], $script_dependencies, $script_data['version'], true );
|
||||
|
||||
if ( $has_i18n && function_exists( 'wp_set_script_translations' ) ) {
|
||||
wp_set_script_translations( $handle, 'woo-gutenberg-products-block', $this->package->get_path( 'languages' ) );
|
||||
wp_set_script_translations( $handle, 'woocommerce', $this->package->get_path( 'languages' ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,8 +98,8 @@ class BlockPatterns {
|
|||
self::PATTERNS_AI_DATA_POST_TYPE,
|
||||
array(
|
||||
'labels' => array(
|
||||
'name' => __( 'Patterns AI Data', 'woo-gutenberg-products-block' ),
|
||||
'singular_name' => __( 'Patterns AI Data', 'woo-gutenberg-products-block' ),
|
||||
'name' => __( 'Patterns AI Data', 'woocommerce' ),
|
||||
'singular_name' => __( 'Patterns AI Data', 'woocommerce' ),
|
||||
),
|
||||
'public' => false,
|
||||
'hierarchical' => false,
|
||||
|
@ -141,7 +141,7 @@ class BlockPatterns {
|
|||
esc_html(
|
||||
sprintf(
|
||||
/* translators: %s: file name. */
|
||||
__( 'Could not register file "%s" as a block pattern ("Slug" field missing)', 'woo-gutenberg-products-block' ),
|
||||
__( 'Could not register file "%s" as a block pattern ("Slug" field missing)', 'woocommerce' ),
|
||||
$file
|
||||
)
|
||||
),
|
||||
|
@ -156,7 +156,7 @@ class BlockPatterns {
|
|||
esc_html(
|
||||
sprintf(
|
||||
/* translators: %1s: file name; %2s: slug value found. */
|
||||
__( 'Could not register file "%1$s" as a block pattern (invalid slug "%2$s")', 'woo-gutenberg-products-block' ),
|
||||
__( 'Could not register file "%1$s" as a block pattern (invalid slug "%2$s")', 'woocommerce' ),
|
||||
$file,
|
||||
$pattern_data['slug']
|
||||
)
|
||||
|
@ -177,7 +177,7 @@ class BlockPatterns {
|
|||
esc_html(
|
||||
sprintf(
|
||||
/* translators: %1s: file name; %2s: slug value found. */
|
||||
__( 'Could not register file "%s" as a block pattern ("Title" field missing)', 'woo-gutenberg-products-block' ),
|
||||
__( 'Could not register file "%s" as a block pattern ("Title" field missing)', 'woocommerce' ),
|
||||
$file
|
||||
)
|
||||
),
|
||||
|
@ -223,10 +223,10 @@ class BlockPatterns {
|
|||
}
|
||||
|
||||
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText, WordPress.WP.I18n.LowLevelTranslationFunction
|
||||
$pattern_data['title'] = translate_with_gettext_context( $pattern_data['title'], 'Pattern title', 'woo-gutenberg-products-block' );
|
||||
$pattern_data['title'] = translate_with_gettext_context( $pattern_data['title'], 'Pattern title', 'woocommerce' );
|
||||
if ( ! empty( $pattern_data['description'] ) ) {
|
||||
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText, WordPress.WP.I18n.LowLevelTranslationFunction
|
||||
$pattern_data['description'] = translate_with_gettext_context( $pattern_data['description'], 'Pattern description', 'woo-gutenberg-products-block' );
|
||||
$pattern_data['description'] = translate_with_gettext_context( $pattern_data['description'], 'Pattern description', 'woocommerce' );
|
||||
}
|
||||
|
||||
$pattern_data_from_dictionary = $this->get_pattern_from_dictionary( $dictionary, $pattern_data['slug'] );
|
||||
|
@ -262,7 +262,7 @@ class BlockPatterns {
|
|||
register_block_pattern_category(
|
||||
$category_slug,
|
||||
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
|
||||
array( 'label' => __( $category, 'woo-gutenberg-products-block' ) )
|
||||
array( 'label' => __( $category, 'woocommerce' ) )
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,7 @@ class BlockPatterns {
|
|||
if ( ! $allow_ai_connection ) {
|
||||
return new \WP_Error(
|
||||
'ai_connection_not_allowed',
|
||||
__( 'AI content generation is not allowed on this store. Update your store settings if you wish to enable this feature.', 'woo-gutenberg-products-block' )
|
||||
__( 'AI content generation is not allowed on this store. Update your store settings if you wish to enable this feature.', 'woocommerce' )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -146,8 +146,8 @@ class BlockTemplatesController {
|
|||
public function register_mini_cart_template_part_area( $default_area_definitions ) {
|
||||
$mini_cart_template_part_area = [
|
||||
'area' => 'mini-cart',
|
||||
'label' => __( 'Mini-Cart', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The Mini-Cart template allows shoppers to see their cart items and provides access to the Cart and Checkout pages.', 'woo-gutenberg-products-block' ),
|
||||
'label' => __( 'Mini-Cart', 'woocommerce' ),
|
||||
'description' => __( 'The Mini-Cart template allows shoppers to see their cart items and provides access to the Cart and Checkout pages.', 'woocommerce' ),
|
||||
'icon' => 'mini-cart',
|
||||
'area_tag' => 'mini-cart',
|
||||
];
|
||||
|
@ -286,7 +286,7 @@ class BlockTemplatesController {
|
|||
}
|
||||
|
||||
/**
|
||||
* This function checks if there's a block template file in `woo-gutenberg-products-block/templates/templates/`
|
||||
* This function checks if there's a block template file in `woocommerce/templates/templates/`
|
||||
* to return to pre_get_posts short-circuiting the query in Gutenberg.
|
||||
*
|
||||
* @param \WP_Block_Template|null $template Return a block template object to short-circuit the default query,
|
||||
|
@ -754,7 +754,7 @@ class BlockTemplatesController {
|
|||
is_shop() &&
|
||||
'product' === $post_type
|
||||
) {
|
||||
return __( 'Shop', 'woo-gutenberg-products-block' );
|
||||
return __( 'Shop', 'woocommerce' );
|
||||
}
|
||||
|
||||
return $post_type_name;
|
||||
|
|
|
@ -108,7 +108,7 @@ abstract class AbstractBlock {
|
|||
*/
|
||||
protected function initialize() {
|
||||
if ( empty( $this->block_name ) ) {
|
||||
_doing_it_wrong( __METHOD__, esc_html__( 'Block name is required.', 'woo-gutenberg-products-block' ), '4.5.0' );
|
||||
_doing_it_wrong( __METHOD__, esc_html__( 'Block name is required.', 'woocommerce' ), '4.5.0' );
|
||||
return false;
|
||||
}
|
||||
$this->integration_registry->initialize( $this->block_name . '_block' );
|
||||
|
@ -441,7 +441,7 @@ abstract class AbstractBlock {
|
|||
* enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
|
||||
* Do not translate into your own language.
|
||||
*/
|
||||
'wordCountType' => _x( 'words', 'Word count type. Do not translate!', 'woo-gutenberg-products-block' ),
|
||||
'wordCountType' => _x( 'words', 'Word count type. Do not translate!', 'woocommerce' ),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -619,8 +619,8 @@ abstract class AbstractProductGrid extends AbstractDynamicBlock {
|
|||
}
|
||||
|
||||
return '<div class="wc-block-grid__product-onsale">
|
||||
<span aria-hidden="true">' . esc_html__( 'Sale', 'woo-gutenberg-products-block' ) . '</span>
|
||||
<span class="screen-reader-text">' . esc_html__( 'Product on sale', 'woo-gutenberg-products-block' ) . '</span>
|
||||
<span aria-hidden="true">' . esc_html__( 'Sale', 'woocommerce' ) . '</span>
|
||||
<span class="screen-reader-text">' . esc_html__( 'Product on sale', 'woocommerce' ) . '</span>
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ class Cart extends AbstractBlock {
|
|||
array(
|
||||
'title' => '',
|
||||
'inserter' => false,
|
||||
'content' => '<!-- wp:heading {"align":"wide", "level":1} --><h1 class="wp-block-heading alignwide">' . esc_html__( 'Cart', 'woo-gutenberg-products-block' ) . '</h1><!-- /wp:heading -->',
|
||||
'content' => '<!-- wp:heading {"align":"wide", "level":1} --><h1 class="wp-block-heading alignwide">' . esc_html__( 'Cart', 'woocommerce' ) . '</h1><!-- /wp:heading -->',
|
||||
)
|
||||
);
|
||||
register_block_pattern(
|
||||
|
@ -65,7 +65,7 @@ class Cart extends AbstractBlock {
|
|||
array(
|
||||
'title' => '',
|
||||
'inserter' => false,
|
||||
'content' => '<!-- wp:heading {"fontSize":"large"} --><h2 class="wp-block-heading has-large-font-size">' . esc_html__( 'You may be interested in…', 'woo-gutenberg-products-block' ) . '</h2><!-- /wp:heading -->',
|
||||
'content' => '<!-- wp:heading {"fontSize":"large"} --><h2 class="wp-block-heading has-large-font-size">' . esc_html__( 'You may be interested in…', 'woocommerce' ) . '</h2><!-- /wp:heading -->',
|
||||
)
|
||||
);
|
||||
register_block_pattern(
|
||||
|
@ -74,8 +74,8 @@ class Cart extends AbstractBlock {
|
|||
'title' => '',
|
||||
'inserter' => false,
|
||||
'content' => '
|
||||
<!-- wp:heading {"textAlign":"center","className":"with-empty-cart-icon wc-block-cart__empty-cart__title"} --><h2 class="wp-block-heading has-text-align-center with-empty-cart-icon wc-block-cart__empty-cart__title">' . esc_html__( 'Your cart is currently empty!', 'woo-gutenberg-products-block' ) . '</h2><!-- /wp:heading -->
|
||||
<!-- wp:paragraph {"align":"center"} --><p class="has-text-align-center"><a href="' . esc_attr( esc_url( $shop_permalink ) ) . '">' . esc_html__( 'Browse store', 'woo-gutenberg-products-block' ) . '</a></p><!-- /wp:paragraph -->
|
||||
<!-- wp:heading {"textAlign":"center","className":"with-empty-cart-icon wc-block-cart__empty-cart__title"} --><h2 class="wp-block-heading has-text-align-center with-empty-cart-icon wc-block-cart__empty-cart__title">' . esc_html__( 'Your cart is currently empty!', 'woocommerce' ) . '</h2><!-- /wp:heading -->
|
||||
<!-- wp:paragraph {"align":"center"} --><p class="has-text-align-center"><a href="' . esc_attr( esc_url( $shop_permalink ) ) . '">' . esc_html__( 'Browse store', 'woocommerce' ) . '</a></p><!-- /wp:paragraph -->
|
||||
',
|
||||
)
|
||||
);
|
||||
|
@ -84,7 +84,7 @@ class Cart extends AbstractBlock {
|
|||
array(
|
||||
'title' => '',
|
||||
'inserter' => false,
|
||||
'content' => '<!-- wp:heading {"textAlign":"center"} --><h2 class="wp-block-heading has-text-align-center">' . esc_html__( 'New in store', 'woo-gutenberg-products-block' ) . '</h2><!-- /wp:heading -->',
|
||||
'content' => '<!-- wp:heading {"textAlign":"center"} --><h2 class="wp-block-heading has-text-align-center">' . esc_html__( 'New in store', 'woocommerce' ) . '</h2><!-- /wp:heading -->',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ class Checkout extends AbstractBlock {
|
|||
array(
|
||||
'title' => '',
|
||||
'inserter' => false,
|
||||
'content' => '<!-- wp:heading {"align":"wide", "level":1} --><h1 class="wp-block-heading alignwide">' . esc_html__( 'Checkout', 'woo-gutenberg-products-block' ) . '</h1><!-- /wp:heading -->',
|
||||
'content' => '<!-- wp:heading {"align":"wide", "level":1} --><h1 class="wp-block-heading alignwide">' . esc_html__( 'Checkout', 'woocommerce' ) . '</h1><!-- /wp:heading -->',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -317,8 +317,8 @@ class Checkout extends AbstractBlock {
|
|||
);
|
||||
$formatted_shipping_zones[] = [
|
||||
'id' => 0,
|
||||
'title' => __( 'International', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Locations outside all other zones', 'woo-gutenberg-products-block' ),
|
||||
'title' => __( 'International', 'woocommerce' ),
|
||||
'description' => __( 'Locations outside all other zones', 'woocommerce' ),
|
||||
];
|
||||
$this->asset_data_registry->add( 'activeShippingZones', $formatted_shipping_zones );
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ class ClassicTemplate extends AbstractDynamicBlock {
|
|||
'<%1$s %2$s>%3$s</%1$s>',
|
||||
'h1',
|
||||
get_block_wrapper_attributes(), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
esc_html__( 'Order confirmation', 'woo-gutenberg-products-block' )
|
||||
esc_html__( 'Order confirmation', 'woocommerce' )
|
||||
);
|
||||
|
||||
WC_Shortcode_Checkout::output( array() );
|
||||
|
|
|
@ -149,7 +149,7 @@ final class CollectionAttributeFilter extends AbstractBlock {
|
|||
</span>',
|
||||
$option['count'],
|
||||
// translators: %d is the number of products.
|
||||
sprintf( _n( '%d product', '%d products', $option['count'], 'woo-gutenberg-products-block' ), $option['count'] )
|
||||
sprintf( _n( '%d product', '%d products', $option['count'], 'woocommerce' ), $option['count'] )
|
||||
) :
|
||||
'';
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ final class CollectionStockFilter extends AbstractBlock {
|
|||
<?php if ( $show_counts ) : ?>
|
||||
<?php
|
||||
// translators: %s: number of products.
|
||||
$screen_reader_text = sprintf( _n( '%s product', '%s products', $stock_count['count'], 'woo-gutenberg-products-block' ), number_format_i18n( $stock_count['count'] ) );
|
||||
$screen_reader_text = sprintf( _n( '%s product', '%s products', $stock_count['count'], 'woocommerce' ), number_format_i18n( $stock_count['count'] ) );
|
||||
?>
|
||||
<span>
|
||||
<span aria-hidden="true">
|
||||
|
|
|
@ -103,8 +103,8 @@ class CustomerAccount extends AbstractBlock {
|
|||
}
|
||||
|
||||
return get_current_user_id()
|
||||
? __( 'My Account', 'woo-gutenberg-products-block' )
|
||||
: __( 'Login', 'woo-gutenberg-products-block' );
|
||||
? __( 'My Account', 'woocommerce' )
|
||||
: __( 'Login', 'woocommerce' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -571,9 +571,9 @@ class MiniCart extends AbstractBlock {
|
|||
register_block_pattern(
|
||||
'woocommerce/mini-cart-empty-cart-message',
|
||||
array(
|
||||
'title' => __( 'Empty Mini-Cart Message', 'woo-gutenberg-products-block' ),
|
||||
'title' => __( 'Empty Mini-Cart Message', 'woocommerce' ),
|
||||
'inserter' => false,
|
||||
'content' => '<!-- wp:paragraph {"align":"center"} --><p class="has-text-align-center"><strong>' . __( 'Your cart is currently empty!', 'woo-gutenberg-products-block' ) . '</strong></p><!-- /wp:paragraph -->',
|
||||
'content' => '<!-- wp:paragraph {"align":"center"} --><p class="has-text-align-center"><strong>' . __( 'Your cart is currently empty!', 'woocommerce' ) . '</strong></p><!-- /wp:paragraph -->',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ abstract class AbstractOrderConfirmationBlock extends AbstractBlock {
|
|||
array(
|
||||
'title' => '',
|
||||
'inserter' => false,
|
||||
'content' => '<!-- wp:heading {"level":3,"style":{"typography":{"fontSize":"24px"}}} --><h3 class="wp-block-heading" style="font-size:24px">' . esc_html__( 'Order details', 'woo-gutenberg-products-block' ) . '</h3><!-- /wp:heading -->',
|
||||
'content' => '<!-- wp:heading {"level":3,"style":{"typography":{"fontSize":"24px"}}} --><h3 class="wp-block-heading" style="font-size:24px">' . esc_html__( 'Order details', 'woocommerce' ) . '</h3><!-- /wp:heading -->',
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -276,7 +276,7 @@ abstract class AbstractOrderConfirmationBlock extends AbstractBlock {
|
|||
array(
|
||||
'title' => '',
|
||||
'inserter' => false,
|
||||
'content' => '<!-- wp:heading {"level":3,"style":{"typography":{"fontSize":"24px"}}} --><h3 class="wp-block-heading" style="font-size:24px">' . esc_html__( 'Downloads', 'woo-gutenberg-products-block' ) . '</h3><!-- /wp:heading -->',
|
||||
'content' => '<!-- wp:heading {"level":3,"style":{"typography":{"fontSize":"24px"}}} --><h3 class="wp-block-heading" style="font-size:24px">' . esc_html__( 'Downloads', 'woocommerce' ) . '</h3><!-- /wp:heading -->',
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -285,7 +285,7 @@ abstract class AbstractOrderConfirmationBlock extends AbstractBlock {
|
|||
array(
|
||||
'title' => '',
|
||||
'inserter' => false,
|
||||
'content' => '<!-- wp:heading {"level":3,"style":{"typography":{"fontSize":"24px"}}} --><h3 class="wp-block-heading" style="font-size:24px">' . esc_html__( 'Shipping address', 'woo-gutenberg-products-block' ) . '</h3><!-- /wp:heading -->',
|
||||
'content' => '<!-- wp:heading {"level":3,"style":{"typography":{"fontSize":"24px"}}} --><h3 class="wp-block-heading" style="font-size:24px">' . esc_html__( 'Shipping address', 'woocommerce' ) . '</h3><!-- /wp:heading -->',
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -294,7 +294,7 @@ abstract class AbstractOrderConfirmationBlock extends AbstractBlock {
|
|||
array(
|
||||
'title' => '',
|
||||
'inserter' => false,
|
||||
'content' => '<!-- wp:heading {"level":3,"style":{"typography":{"fontSize":"24px"}}} --><h3 class="wp-block-heading" style="font-size:24px">' . esc_html__( 'Billing address', 'woo-gutenberg-products-block' ) . '</h3><!-- /wp:heading -->',
|
||||
'content' => '<!-- wp:heading {"level":3,"style":{"typography":{"fontSize":"24px"}}} --><h3 class="wp-block-heading" style="font-size:24px">' . esc_html__( 'Billing address', 'woocommerce' ) . '</h3><!-- /wp:heading -->',
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -141,13 +141,13 @@ class Downloads extends AbstractOrderConfirmationBlock {
|
|||
$return .= '<a href="' . esc_url( $download['download_url'] ) . '" class="woocommerce-MyAccount-downloads-file button alt">' . esc_html( $download['download_name'] ) . '</a>';
|
||||
break;
|
||||
case 'download-remaining':
|
||||
$return .= is_numeric( $download['downloads_remaining'] ) ? esc_html( $download['downloads_remaining'] ) : esc_html__( '∞', 'woo-gutenberg-products-block' );
|
||||
$return .= is_numeric( $download['downloads_remaining'] ) ? esc_html( $download['downloads_remaining'] ) : esc_html__( '∞', 'woocommerce' );
|
||||
break;
|
||||
case 'download-expires':
|
||||
if ( ! empty( $download['access_expires'] ) ) {
|
||||
$return .= '<time datetime="' . esc_attr( gmdate( 'Y-m-d', strtotime( $download['access_expires'] ) ) ) . '" title="' . esc_attr( strtotime( $download['access_expires'] ) ) . '">' . esc_html( date_i18n( get_option( 'date_format' ), strtotime( $download['access_expires'] ) ) ) . '</time>';
|
||||
} else {
|
||||
$return .= esc_html__( 'Never', 'woo-gutenberg-products-block' );
|
||||
$return .= esc_html__( 'Never', 'woocommerce' );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ class Status extends AbstractOrderConfirmationBlock {
|
|||
protected function render_content( $order, $permission = false, $attributes = [], $content = '' ) {
|
||||
if ( ! $permission ) {
|
||||
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
|
||||
return '<p>' . wp_kses_post( apply_filters( 'woocommerce_thankyou_order_received_text', esc_html__( 'Thank you. Your order has been received.', 'woo-gutenberg-products-block' ), null ) ) . '</p>';
|
||||
return '<p>' . wp_kses_post( apply_filters( 'woocommerce_thankyou_order_received_text', esc_html__( 'Thank you. Your order has been received.', 'woocommerce' ), null ) ) . '</p>';
|
||||
}
|
||||
|
||||
$content = $this->get_hook_content( 'woocommerce_before_thankyou', [ $order->get_id() ] );
|
||||
|
@ -74,7 +74,7 @@ class Status extends AbstractOrderConfirmationBlock {
|
|||
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
|
||||
apply_filters(
|
||||
'woocommerce_thankyou_order_received_text',
|
||||
esc_html__( 'Your order has been cancelled.', 'woo-gutenberg-products-block' ),
|
||||
esc_html__( 'Your order has been cancelled.', 'woocommerce' ),
|
||||
$order
|
||||
)
|
||||
) . '</p>';
|
||||
|
@ -86,7 +86,7 @@ class Status extends AbstractOrderConfirmationBlock {
|
|||
apply_filters(
|
||||
'woocommerce_thankyou_order_received_text',
|
||||
// translators: %s: date and time of the order refund.
|
||||
esc_html__( 'Your order was refunded %s.', 'woo-gutenberg-products-block' ),
|
||||
esc_html__( 'Your order was refunded %s.', 'woocommerce' ),
|
||||
$order
|
||||
),
|
||||
wc_format_datetime( $order->get_date_modified() )
|
||||
|
@ -98,18 +98,18 @@ class Status extends AbstractOrderConfirmationBlock {
|
|||
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
|
||||
apply_filters(
|
||||
'woocommerce_thankyou_order_received_text',
|
||||
esc_html__( 'Thank you. Your order has been fulfilled.', 'woo-gutenberg-products-block' ),
|
||||
esc_html__( 'Thank you. Your order has been fulfilled.', 'woocommerce' ),
|
||||
$order
|
||||
)
|
||||
) . '</p>';
|
||||
break;
|
||||
case 'failed':
|
||||
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
|
||||
$order_received_text = apply_filters( 'woocommerce_thankyou_order_received_text', esc_html__( 'Your order cannot be processed as the originating bank/merchant has declined your transaction. Please attempt your purchase again.', 'woo-gutenberg-products-block' ), null );
|
||||
$actions = '<a href="' . esc_url( $order->get_checkout_payment_url() ) . '" class="button">' . esc_html__( 'Try again', 'woo-gutenberg-products-block' ) . '</a> ';
|
||||
$order_received_text = apply_filters( 'woocommerce_thankyou_order_received_text', esc_html__( 'Your order cannot be processed as the originating bank/merchant has declined your transaction. Please attempt your purchase again.', 'woocommerce' ), null );
|
||||
$actions = '<a href="' . esc_url( $order->get_checkout_payment_url() ) . '" class="button">' . esc_html__( 'Try again', 'woocommerce' ) . '</a> ';
|
||||
|
||||
if ( wc_get_page_permalink( 'myaccount' ) ) {
|
||||
$actions .= '<a href="' . esc_url( wc_get_page_permalink( 'myaccount' ) ) . '" class="button">' . esc_html__( 'My account', 'woo-gutenberg-products-block' ) . '</a> ';
|
||||
$actions .= '<a href="' . esc_url( wc_get_page_permalink( 'myaccount' ) ) . '" class="button">' . esc_html__( 'My account', 'woocommerce' ) . '</a> ';
|
||||
}
|
||||
|
||||
$content .= '
|
||||
|
@ -122,7 +122,7 @@ class Status extends AbstractOrderConfirmationBlock {
|
|||
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
|
||||
apply_filters(
|
||||
'woocommerce_thankyou_order_received_text',
|
||||
esc_html__( 'Thank you. Your order has been received.', 'woo-gutenberg-products-block' ),
|
||||
esc_html__( 'Thank you. Your order has been received.', 'woocommerce' ),
|
||||
$order
|
||||
)
|
||||
) . '</p>';
|
||||
|
@ -139,7 +139,7 @@ class Status extends AbstractOrderConfirmationBlock {
|
|||
*/
|
||||
protected function render_content_fallback() {
|
||||
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
|
||||
return '<p>' . esc_html__( 'Please check your email for the order confirmation.', 'woo-gutenberg-products-block' ) . '</p>';
|
||||
return '<p>' . esc_html__( 'Please check your email for the order confirmation.', 'woocommerce' ) . '</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,12 +150,12 @@ class Status extends AbstractOrderConfirmationBlock {
|
|||
*/
|
||||
protected function render_confirmation_notice( $order = null ) {
|
||||
if ( ! $order ) {
|
||||
$content = '<p>' . esc_html__( 'If you\'ve just placed an order, give your email a quick check for the confirmation.', 'woo-gutenberg-products-block' );
|
||||
$content = '<p>' . esc_html__( 'If you\'ve just placed an order, give your email a quick check for the confirmation.', 'woocommerce' );
|
||||
|
||||
if ( wc_get_page_permalink( 'myaccount' ) ) {
|
||||
$content .= ' ' . sprintf(
|
||||
/* translators: 1: opening a link tag 2: closing a link tag */
|
||||
esc_html__( 'Have an account with us? %1$sLog in here to view your order details%2$s.', 'woo-gutenberg-products-block' ),
|
||||
esc_html__( 'Have an account with us? %1$sLog in here to view your order details%2$s.', 'woocommerce' ),
|
||||
'<a href="' . esc_url( wc_get_page_permalink( 'myaccount' ) ) . '" class="button">',
|
||||
'</a>'
|
||||
);
|
||||
|
@ -177,16 +177,16 @@ class Status extends AbstractOrderConfirmationBlock {
|
|||
$my_account_page = wc_get_page_permalink( 'myaccount' );
|
||||
|
||||
$content = '<p>';
|
||||
$content .= esc_html__( 'Great news! Your order has been received, and a confirmation will be sent to your email address.', 'woo-gutenberg-products-block' );
|
||||
$content .= esc_html__( 'Great news! Your order has been received, and a confirmation will be sent to your email address.', 'woocommerce' );
|
||||
$content .= $my_account_page ? ' ' . sprintf(
|
||||
/* translators: 1: opening a link tag 2: closing a link tag */
|
||||
esc_html__( 'Have an account with us? %1$sLog in here%2$s to view your order.', 'woo-gutenberg-products-block' ),
|
||||
esc_html__( 'Have an account with us? %1$sLog in here%2$s to view your order.', 'woocommerce' ),
|
||||
'<a href="' . esc_url( $my_account_page ) . '" class="button">',
|
||||
'</a>'
|
||||
) : '';
|
||||
|
||||
if ( $verification_required && $verification_permitted ) {
|
||||
$content .= ' ' . esc_html__( 'Alternatively, confirm the email address linked to the order below.', 'woo-gutenberg-products-block' );
|
||||
$content .= ' ' . esc_html__( 'Alternatively, confirm the email address linked to the order below.', 'woocommerce' );
|
||||
}
|
||||
|
||||
$content .= '</p>';
|
||||
|
@ -205,7 +205,7 @@ class Status extends AbstractOrderConfirmationBlock {
|
|||
*/
|
||||
protected function render_verification_form() {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Missing
|
||||
$check_submission_notice = ! empty( $_POST ) ? wc_print_notice( esc_html__( 'We were unable to verify the email address you provided. Please try again.', 'woo-gutenberg-products-block' ), 'error', [], true ) : '';
|
||||
$check_submission_notice = ! empty( $_POST ) ? wc_print_notice( esc_html__( 'We were unable to verify the email address you provided. Please try again.', 'woocommerce' ), 'error', [], true ) : '';
|
||||
|
||||
return '<form method="post" class="woocommerce-form woocommerce-verify-email">' .
|
||||
$check_submission_notice .
|
||||
|
@ -215,7 +215,7 @@ class Status extends AbstractOrderConfirmationBlock {
|
|||
<input type="email" name="email" id="%1$s" autocomplete="email" class="input-text" required />
|
||||
</p>',
|
||||
esc_attr( 'verify-email' ),
|
||||
esc_html__( 'Email address', 'woo-gutenberg-products-block' ) . ' <span class="required">*</span>'
|
||||
esc_html__( 'Email address', 'woocommerce' ) . ' <span class="required">*</span>'
|
||||
) .
|
||||
sprintf(
|
||||
'<p class="form-row login-submit">
|
||||
|
@ -223,7 +223,7 @@ class Status extends AbstractOrderConfirmationBlock {
|
|||
%3$s
|
||||
</p>',
|
||||
esc_attr( 'verify-email-submit' ),
|
||||
esc_html__( 'Confirm email and view order', 'woo-gutenberg-products-block' ),
|
||||
esc_html__( 'Confirm email and view order', 'woocommerce' ),
|
||||
wp_nonce_field( 'wc_verify_email', 'check_submission', true, false ),
|
||||
esc_attr( wc_wp_theme_get_element_class_name( 'button' ) )
|
||||
) .
|
||||
|
|
|
@ -29,11 +29,11 @@ class Summary extends AbstractOrderConfirmationBlock {
|
|||
}
|
||||
|
||||
$content = '<ul class="wc-block-order-confirmation-summary-list">';
|
||||
$content .= $this->render_summary_row( __( 'Order number:', 'woo-gutenberg-products-block' ), $order->get_order_number() );
|
||||
$content .= $this->render_summary_row( __( 'Date:', 'woo-gutenberg-products-block' ), wc_format_datetime( $order->get_date_created() ) );
|
||||
$content .= $this->render_summary_row( __( 'Total:', 'woo-gutenberg-products-block' ), $order->get_formatted_order_total() );
|
||||
$content .= $this->render_summary_row( __( 'Email:', 'woo-gutenberg-products-block' ), $order->get_billing_email() );
|
||||
$content .= $this->render_summary_row( __( 'Payment method:', 'woo-gutenberg-products-block' ), $order->get_payment_method_title() );
|
||||
$content .= $this->render_summary_row( __( 'Order number:', 'woocommerce' ), $order->get_order_number() );
|
||||
$content .= $this->render_summary_row( __( 'Date:', 'woocommerce' ), wc_format_datetime( $order->get_date_created() ) );
|
||||
$content .= $this->render_summary_row( __( 'Total:', 'woocommerce' ), $order->get_formatted_order_total() );
|
||||
$content .= $this->render_summary_row( __( 'Email:', 'woocommerce' ), $order->get_billing_email() );
|
||||
$content .= $this->render_summary_row( __( 'Payment method:', 'woocommerce' ), $order->get_payment_method_title() );
|
||||
$content .= '</ul>';
|
||||
|
||||
return $content;
|
||||
|
|
|
@ -35,8 +35,8 @@ class Totals extends AbstractOrderConfirmationBlock {
|
|||
<table cellspacing="0" class="wc-block-order-confirmation-totals__table ' . esc_attr( $classes_and_styles['classes'] ) . '" style="' . esc_attr( $classes_and_styles['styles'] ) . '">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="wc-block-order-confirmation-totals__product">' . esc_html__( 'Product', 'woo-gutenberg-products-block' ) . '</th>
|
||||
<th class="wc-block-order-confirmation-totals__total">' . esc_html__( 'Total', 'woo-gutenberg-products-block' ) . '</th>
|
||||
<th class="wc-block-order-confirmation-totals__product">' . esc_html__( 'Product', 'woocommerce' ) . '</th>
|
||||
<th class="wc-block-order-confirmation-totals__total">' . esc_html__( 'Total', 'woocommerce' ) . '</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -223,7 +223,7 @@ class Totals extends AbstractOrderConfirmationBlock {
|
|||
|
||||
return '<div class="wc-block-order-confirmation-order-note">' .
|
||||
'<p class="wc-block-order-confirmation-order-note__label">' .
|
||||
esc_html__( 'Note:', 'woo-gutenberg-products-block' ) .
|
||||
esc_html__( 'Note:', 'woocommerce' ) .
|
||||
'</p>' .
|
||||
'<p>' . wp_kses_post( nl2br( wptexturize( $order->get_customer_note() ) ) ) . '</p>' .
|
||||
'</div>';
|
||||
|
|
|
@ -82,7 +82,7 @@ class ProductButton extends AbstractBlock {
|
|||
array(
|
||||
'inTheCartText' => sprintf(
|
||||
/* translators: %s: product number. */
|
||||
__( '%s in cart', 'woo-gutenberg-products-block' ),
|
||||
__( '%s in cart', 'woocommerce' ),
|
||||
'###'
|
||||
),
|
||||
)
|
||||
|
@ -93,7 +93,7 @@ class ProductButton extends AbstractBlock {
|
|||
$more_than_one_item = $number_of_items_in_cart > 0;
|
||||
$initial_product_text = $more_than_one_item ? sprintf(
|
||||
/* translators: %s: product number. */
|
||||
__( '%s in cart', 'woo-gutenberg-products-block' ),
|
||||
__( '%s in cart', 'woocommerce' ),
|
||||
$number_of_items_in_cart
|
||||
) : $product->add_to_cart_text();
|
||||
$cart_redirect_after_add = get_option( 'woocommerce_cart_redirect_after_add' ) === 'yes';
|
||||
|
@ -132,7 +132,7 @@ class ProductButton extends AbstractBlock {
|
|||
$context = array(
|
||||
'quantityToAdd' => $quantity_to_add,
|
||||
'productId' => $product->get_id(),
|
||||
'addToCartText' => null !== $product->add_to_cart_text() ? $product->add_to_cart_text() : __( 'Add to cart', 'woo-gutenberg-products-block' ),
|
||||
'addToCartText' => null !== $product->add_to_cart_text() ? $product->add_to_cart_text() : __( 'Add to cart', 'woocommerce' ),
|
||||
'temporaryNumberOfItems' => $number_of_items_in_cart,
|
||||
'animationStatus' => 'IDLE',
|
||||
);
|
||||
|
@ -275,7 +275,7 @@ class ProductButton extends AbstractBlock {
|
|||
</a>
|
||||
</span>',
|
||||
wc_get_cart_url(),
|
||||
__( 'View cart', 'woo-gutenberg-products-block' )
|
||||
__( 'View cart', 'woocommerce' )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -233,8 +233,8 @@ class ProductCategories extends AbstractDynamicBlock {
|
|||
*/
|
||||
protected function renderDropdown( $categories, $attributes, $uid ) {
|
||||
$aria_label = empty( $attributes['hasCount'] ) ?
|
||||
__( 'List of categories', 'woo-gutenberg-products-block' ) :
|
||||
__( 'List of categories with their product counts', 'woo-gutenberg-products-block' );
|
||||
__( 'List of categories', 'woocommerce' ) :
|
||||
__( 'List of categories with their product counts', 'woocommerce' );
|
||||
|
||||
$output = '
|
||||
<div class="wc-block-product-categories__dropdown">
|
||||
|
@ -242,11 +242,11 @@ class ProductCategories extends AbstractDynamicBlock {
|
|||
class="screen-reader-text"
|
||||
for="' . esc_attr( $uid ) . '-select"
|
||||
>
|
||||
' . esc_html__( 'Select a category', 'woo-gutenberg-products-block' ) . '
|
||||
' . esc_html__( 'Select a category', 'woocommerce' ) . '
|
||||
</label>
|
||||
<select aria-label="' . esc_attr( $aria_label ) . '" id="' . esc_attr( $uid ) . '-select">
|
||||
<option value="false" hidden>
|
||||
' . esc_html__( 'Select a category', 'woo-gutenberg-products-block' ) . '
|
||||
' . esc_html__( 'Select a category', 'woocommerce' ) . '
|
||||
</option>
|
||||
' . $this->renderDropdownOptions( $categories, $attributes, $uid ) . '
|
||||
</select>
|
||||
|
@ -254,7 +254,7 @@ class ProductCategories extends AbstractDynamicBlock {
|
|||
<button
|
||||
type="button"
|
||||
class="wc-block-product-categories__button"
|
||||
aria-label="' . esc_html__( 'Go to category', 'woo-gutenberg-products-block' ) . '"
|
||||
aria-label="' . esc_html__( 'Go to category', 'woocommerce' ) . '"
|
||||
onclick="const url = document.getElementById( \'' . esc_attr( $uid ) . '-select\' ).value; if ( \'false\' !== url ) document.location.href = url;"
|
||||
>
|
||||
<svg
|
||||
|
@ -394,7 +394,7 @@ class ProductCategories extends AbstractDynamicBlock {
|
|||
|
||||
$screen_reader_text = sprintf(
|
||||
/* translators: %s number of products in cart. */
|
||||
_n( '%d product', '%d products', absint( $category->count ), 'woo-gutenberg-products-block' ),
|
||||
_n( '%d product', '%d products', absint( $category->count ), 'woocommerce' ),
|
||||
absint( $category->count )
|
||||
);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class ProductGalleryThumbnails extends AbstractBlock {
|
|||
return sprintf(
|
||||
$view_all_html,
|
||||
esc_html( $remaining_thumbnails_count ),
|
||||
esc_html__( 'View all', 'woo-gutenberg-products-block' )
|
||||
esc_html__( 'View all', 'woocommerce' )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ class ProductImage extends AbstractBlock {
|
|||
esc_attr( $attributes['saleBadgeAlign'] ),
|
||||
isset( $font_size['class'] ) ? esc_attr( $font_size['class'] ) : '',
|
||||
isset( $font_size['style'] ) ? esc_attr( $font_size['style'] ) : '',
|
||||
esc_html__( 'Sale', 'woo-gutenberg-products-block' )
|
||||
esc_html__( 'Sale', 'woocommerce' )
|
||||
);
|
||||
return $on_sale_badge;
|
||||
}
|
||||
|
|
|
@ -147,14 +147,14 @@ class ProductRating extends AbstractBlock {
|
|||
|
||||
if ( 0 < $average_rating || false === $product_permalink ) {
|
||||
/* translators: %s: rating */
|
||||
$label = sprintf( __( 'Rated %s out of 5', 'woo-gutenberg-products-block' ), $average_rating );
|
||||
$label = sprintf( __( 'Rated %s out of 5', 'woocommerce' ), $average_rating );
|
||||
$customer_reviews_count = sprintf(
|
||||
/* translators: %s is referring to the total of reviews for a product */
|
||||
_n(
|
||||
'(%s customer review)',
|
||||
'(%s customer reviews)',
|
||||
$reviews_count,
|
||||
'woo-gutenberg-products-block'
|
||||
'woocommerce'
|
||||
),
|
||||
esc_html( $reviews_count )
|
||||
);
|
||||
|
|
|
@ -153,7 +153,7 @@ class ProductRatingCounter extends AbstractBlock {
|
|||
'(%s customer review)',
|
||||
'(%s customer reviews)',
|
||||
$reviews_count,
|
||||
'woo-gutenberg-products-block'
|
||||
'woocommerce'
|
||||
),
|
||||
esc_html( $reviews_count )
|
||||
);
|
||||
|
|
|
@ -116,7 +116,7 @@ class ProductRatingStars extends AbstractBlock {
|
|||
|
||||
if ( 0 < $average_rating || false === $product_permalink ) {
|
||||
/* translators: %s: rating */
|
||||
$label = sprintf( __( 'Rated %s out of 5', 'woo-gutenberg-products-block' ), $average_rating );
|
||||
$label = sprintf( __( 'Rated %s out of 5', 'woocommerce' ), $average_rating );
|
||||
$html = sprintf(
|
||||
'<div class="wc-block-components-product-rating-stars__container">
|
||||
<div class="wc-block-components-product-rating__stars wc-block-grid__product-rating__stars" role="img" aria-label="%1$s">
|
||||
|
|
|
@ -112,9 +112,9 @@ class ProductSaleBadge extends AbstractBlock {
|
|||
|
||||
$output = '<div class="wp-block-woocommerce-product-sale-badge ' . esc_attr( $classname ) . '">';
|
||||
$output .= sprintf( '<div class="wc-block-components-product-sale-badge %1$s wc-block-components-product-sale-badge--align-%2$s" style="%3$s">', esc_attr( $classes_and_styles['classes'] ), esc_attr( $align ), esc_attr( $classes_and_styles['styles'] ) );
|
||||
$output .= '<span class="wc-block-components-product-sale-badge__text" aria-hidden="true">' . __( 'Sale', 'woo-gutenberg-products-block' ) . '</span>';
|
||||
$output .= '<span class="wc-block-components-product-sale-badge__text" aria-hidden="true">' . __( 'Sale', 'woocommerce' ) . '</span>';
|
||||
$output .= '<span class="screen-reader-text">'
|
||||
. __( 'Product on sale', 'woo-gutenberg-products-block' )
|
||||
. __( 'Product on sale', 'woocommerce' )
|
||||
. '</span>';
|
||||
$output .= '</div></div>';
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ class ProductSearch extends AbstractBlock {
|
|||
'hasLabel' => true,
|
||||
'align' => '',
|
||||
'className' => '',
|
||||
'label' => __( 'Search', 'woo-gutenberg-products-block' ),
|
||||
'placeholder' => __( 'Search products…', 'woo-gutenberg-products-block' ),
|
||||
'label' => __( 'Search', 'woocommerce' ),
|
||||
'placeholder' => __( 'Search products…', 'woocommerce' ),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -108,7 +108,7 @@ class ProductSearch extends AbstractBlock {
|
|||
<path d="M6 15l5-5-5-5 1-2 7 7-7 7z" />
|
||||
</svg>
|
||||
</button>',
|
||||
esc_attr__( 'Search', 'woo-gutenberg-products-block' )
|
||||
esc_attr__( 'Search', 'woocommerce' )
|
||||
);
|
||||
|
||||
$field_markup = '
|
||||
|
|
|
@ -55,15 +55,15 @@ class ProductStockIndicator extends AbstractBlock {
|
|||
if ( $is_low_stock ) {
|
||||
return sprintf(
|
||||
/* translators: %d is number of items in stock for product */
|
||||
__( '%d left in stock', 'woo-gutenberg-products-block' ),
|
||||
__( '%d left in stock', 'woocommerce' ),
|
||||
$low_stock_amount
|
||||
);
|
||||
} elseif ( $is_on_backorder ) {
|
||||
return __( 'Available on backorder', 'woo-gutenberg-products-block' );
|
||||
return __( 'Available on backorder', 'woocommerce' );
|
||||
} elseif ( $is_in_stock ) {
|
||||
return __( 'In stock', 'woo-gutenberg-products-block' );
|
||||
return __( 'In stock', 'woocommerce' );
|
||||
} else {
|
||||
return __( 'Out of stock', 'woo-gutenberg-products-block' );
|
||||
return __( 'Out of stock', 'woocommerce' );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ class Bootstrap {
|
|||
echo '<div class="error"><p>';
|
||||
printf(
|
||||
/* translators: %1$s is the install command, %2$s is the build command, %3$s is the watch command. */
|
||||
esc_html__( 'WooCommerce Blocks development mode requires files to be built. From the plugin directory, run %1$s to install dependencies, %2$s to build the files or %3$s to build the files and watch for changes.', 'woo-gutenberg-products-block' ),
|
||||
esc_html__( 'WooCommerce Blocks development mode requires files to be built. From the plugin directory, run %1$s to install dependencies, %2$s to build the files or %3$s to build the files and watch for changes.', 'woocommerce' ),
|
||||
'<code>npm install</code>',
|
||||
'<code>npm run build</code>',
|
||||
'<code>npm start</code>'
|
||||
|
|
|
@ -76,7 +76,7 @@ class DraftOrders {
|
|||
* @return array
|
||||
*/
|
||||
public function register_draft_order_status( array $statuses ) {
|
||||
$statuses[ self::DB_STATUS ] = _x( 'Draft', 'Order status', 'woo-gutenberg-products-block' );
|
||||
$statuses[ self::DB_STATUS ] = _x( 'Draft', 'Order status', 'woocommerce' );
|
||||
return $statuses;
|
||||
}
|
||||
|
||||
|
@ -100,13 +100,13 @@ class DraftOrders {
|
|||
*/
|
||||
private function get_post_status_properties() {
|
||||
return [
|
||||
'label' => _x( 'Draft', 'Order status', 'woo-gutenberg-products-block' ),
|
||||
'label' => _x( 'Draft', 'Order status', 'woocommerce' ),
|
||||
'public' => false,
|
||||
'exclude_from_search' => false,
|
||||
'show_in_admin_all_list' => false,
|
||||
'show_in_admin_status_list' => true,
|
||||
/* translators: %s: number of orders */
|
||||
'label_count' => _n_noop( 'Drafts <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>', 'woo-gutenberg-products-block' ),
|
||||
'label_count' => _n_noop( 'Drafts <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>', 'woocommerce' ),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,8 @@ class CustomerNewAccount extends \WC_Email {
|
|||
// apply to this email (consistent with the core email).
|
||||
$this->id = 'customer_new_account';
|
||||
$this->customer_email = true;
|
||||
$this->title = __( 'New account', 'woo-gutenberg-products-block' );
|
||||
$this->description = __( '“New Account” emails are sent when a customer signs up via the checkout flow.', 'woo-gutenberg-products-block' );
|
||||
$this->title = __( 'New account', 'woocommerce' );
|
||||
$this->description = __( '“New Account” emails are sent when a customer signs up via the checkout flow.', 'woocommerce' );
|
||||
$this->template_html = 'emails/customer-new-account-blocks.php';
|
||||
$this->template_plain = 'emails/plain/customer-new-account-blocks.php';
|
||||
$this->default_template_path = $package->get_path( '/templates/' );
|
||||
|
@ -71,7 +71,7 @@ class CustomerNewAccount extends \WC_Email {
|
|||
* @return string
|
||||
*/
|
||||
public function get_default_subject() {
|
||||
return __( 'Your {site_title} account has been created!', 'woo-gutenberg-products-block' );
|
||||
return __( 'Your {site_title} account has been created!', 'woocommerce' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -81,7 +81,7 @@ class CustomerNewAccount extends \WC_Email {
|
|||
* @return string
|
||||
*/
|
||||
public function get_default_heading() {
|
||||
return __( 'Welcome to {site_title}', 'woo-gutenberg-products-block' );
|
||||
return __( 'Welcome to {site_title}', 'woocommerce' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -169,6 +169,6 @@ class CustomerNewAccount extends \WC_Email {
|
|||
* @return string
|
||||
*/
|
||||
public function get_default_additional_content() {
|
||||
return __( 'We look forward to seeing you soon.', 'woo-gutenberg-products-block' );
|
||||
return __( 'We look forward to seeing you soon.', 'woocommerce' );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ class ReviewCheckoutTask extends Task {
|
|||
* @return string
|
||||
*/
|
||||
public function get_title() {
|
||||
return __( 'Review your checkout experience', 'woo-gutenberg-products-block' );
|
||||
return __( 'Review your checkout experience', 'woocommerce' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ class ReviewCheckoutTask extends Task {
|
|||
* @return string
|
||||
*/
|
||||
public function get_additional_info() {
|
||||
return __( 'Make sure cart and checkout flows are configured correctly for your shoppers.', 'woo-gutenberg-products-block' );
|
||||
return __( 'Make sure cart and checkout flows are configured correctly for your shoppers.', 'woocommerce' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -86,11 +86,11 @@ class Pexels {
|
|||
}
|
||||
|
||||
if ( $refined_images_count < $required_images && ! empty( $errors ) ) {
|
||||
return new \WP_Error( 'ai_service_unavailable', __( 'AI Service is unavailable, try again later.', 'woo-gutenberg-products-block' ), $errors );
|
||||
return new \WP_Error( 'ai_service_unavailable', __( 'AI Service is unavailable, try again later.', 'woocommerce' ), $errors );
|
||||
}
|
||||
|
||||
if ( empty( $refined_images ) ) {
|
||||
return new \WP_Error( 'woocommerce_no_images_found', __( 'No images found.', 'woo-gutenberg-products-block' ) );
|
||||
return new \WP_Error( 'woocommerce_no_images_found', __( 'No images found.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
return $refined_images;
|
||||
|
@ -117,7 +117,7 @@ class Pexels {
|
|||
}
|
||||
|
||||
if ( ! isset( $response['completion'] ) ) {
|
||||
return new \WP_Error( 'search_term_definition_failed', __( 'The search term definition failed.', 'woo-gutenberg-products-block' ) );
|
||||
return new \WP_Error( 'search_term_definition_failed', __( 'The search term definition failed.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
return $response['completion'];
|
||||
|
@ -162,7 +162,7 @@ class Pexels {
|
|||
}
|
||||
|
||||
if ( ! is_array( $filtered_image_titles ) ) {
|
||||
return new \WP_Error( 'ai_service_unavailable', __( 'AI Service is unavailable, try again later.', 'woo-gutenberg-products-block' ) );
|
||||
return new \WP_Error( 'ai_service_unavailable', __( 'AI Service is unavailable, try again later.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
// Remove the images that are not aligned with the business description.
|
||||
|
@ -199,7 +199,7 @@ class Pexels {
|
|||
'data' => $response_data,
|
||||
];
|
||||
|
||||
return new \WP_Error( 'pexels_api_error', __( 'Request to the Pexels API failed.', 'woo-gutenberg-products-block' ), $error_msg );
|
||||
return new \WP_Error( 'pexels_api_error', __( 'Request to the Pexels API failed.', 'woocommerce' ), $error_msg );
|
||||
}
|
||||
|
||||
$response = $response_data['media'] ?? $response_data;
|
||||
|
|
|
@ -120,7 +120,7 @@ class Installer {
|
|||
echo '<div class="error"><p>';
|
||||
printf(
|
||||
/* translators: %1$s table name, %2$s database user, %3$s database name. */
|
||||
esc_html__( 'WooCommerce %1$s table creation failed. Does the %2$s user have CREATE privileges on the %3$s database?', 'woo-gutenberg-products-block' ),
|
||||
esc_html__( 'WooCommerce %1$s table creation failed. Does the %2$s user have CREATE privileges on the %3$s database?', 'woocommerce' ),
|
||||
'<code>' . esc_html( $table_name ) . '</code>',
|
||||
'<code>' . esc_html( DB_USER ) . '</code>',
|
||||
'<code>' . esc_html( DB_NAME ) . '</code>'
|
||||
|
|
|
@ -32,7 +32,7 @@ class IntegrationRegistry {
|
|||
}
|
||||
|
||||
if ( empty( $this->registry_identifier ) ) {
|
||||
_doing_it_wrong( __METHOD__, esc_html__( 'Integration registry requires an identifier.', 'woo-gutenberg-products-block' ), '4.6.0' );
|
||||
_doing_it_wrong( __METHOD__, esc_html__( 'Integration registry requires an identifier.', 'woocommerce' ), '4.6.0' );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ class IntegrationRegistry {
|
|||
|
||||
if ( $this->is_registered( $name ) ) {
|
||||
/* translators: %s: Integration name. */
|
||||
_doing_it_wrong( __METHOD__, esc_html( sprintf( __( '"%s" is already registered.', 'woo-gutenberg-products-block' ), $name ) ), '4.6.0' );
|
||||
_doing_it_wrong( __METHOD__, esc_html( sprintf( __( '"%s" is already registered.', 'woocommerce' ), $name ) ), '4.6.0' );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ class IntegrationRegistry {
|
|||
|
||||
if ( ! $this->is_registered( $name ) ) {
|
||||
/* translators: %s: Integration name. */
|
||||
_doing_it_wrong( __METHOD__, esc_html( sprintf( __( 'Integration "%s" is not registered.', 'woo-gutenberg-products-block' ), $name ) ), '4.6.0' );
|
||||
_doing_it_wrong( __METHOD__, esc_html( sprintf( __( 'Integration "%s" is not registered.', 'woocommerce' ), $name ) ), '4.6.0' );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class PatternUpdater {
|
|||
*/
|
||||
public function generate_content( $ai_connection, $token, $images, $business_description ) {
|
||||
if ( empty( $images ) ) {
|
||||
return new \WP_Error( 'images_not_found', __( 'No images provided for generating AI content.', 'woo-gutenberg-products-block' ) );
|
||||
return new \WP_Error( 'images_not_found', __( 'No images provided for generating AI content.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
if ( is_wp_error( $images ) ) {
|
||||
|
@ -54,7 +54,7 @@ class PatternUpdater {
|
|||
if ( is_string( $business_description ) && is_string( $last_business_description ) ) {
|
||||
return true;
|
||||
} else {
|
||||
return new \WP_Error( 'business_description_not_found', __( 'No business description provided for generating AI content.', 'woo-gutenberg-products-block' ) );
|
||||
return new \WP_Error( 'business_description_not_found', __( 'No business description provided for generating AI content.', 'woocommerce' ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ class PatternUpdater {
|
|||
}
|
||||
|
||||
if ( empty( $images ) ) {
|
||||
return new WP_Error( 'no_images_found', __( 'No images found.', 'woo-gutenberg-products-block' ) );
|
||||
return new WP_Error( 'no_images_found', __( 'No images found.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
// This is required in case something interrupts the execution of the script and the endpoint is called again on retry.
|
||||
|
@ -78,13 +78,13 @@ class PatternUpdater {
|
|||
$patterns = $this->assign_selected_images_to_patterns( $patterns_dictionary, $images );
|
||||
|
||||
if ( is_wp_error( $patterns ) ) {
|
||||
return new WP_Error( 'failed_to_set_pattern_images', __( 'Failed to set the pattern images.', 'woo-gutenberg-products-block' ) );
|
||||
return new WP_Error( 'failed_to_set_pattern_images', __( 'Failed to set the pattern images.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$ai_generated_patterns_content = $this->generate_ai_content_for_patterns( $ai_connection, $token, $patterns, $business_description );
|
||||
|
||||
if ( is_wp_error( $ai_generated_patterns_content ) ) {
|
||||
return new WP_Error( 'failed_to_set_pattern_content', __( 'Failed to set the pattern content.', 'woo-gutenberg-products-block' ) );
|
||||
return new WP_Error( 'failed_to_set_pattern_content', __( 'Failed to set the pattern content.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$patterns_ai_data_post = PatternsHelper::get_patterns_ai_data_post();
|
||||
|
@ -96,7 +96,7 @@ class PatternUpdater {
|
|||
$updated_content = PatternsHelper::upsert_patterns_ai_data_post( $ai_generated_patterns_content );
|
||||
|
||||
if ( is_wp_error( $updated_content ) ) {
|
||||
return new WP_Error( 'failed_to_update_patterns_content', __( 'Failed to update patterns content.', 'woo-gutenberg-products-block' ) );
|
||||
return new WP_Error( 'failed_to_update_patterns_content', __( 'Failed to update patterns content.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -301,7 +301,7 @@ class PatternUpdater {
|
|||
}
|
||||
|
||||
if ( ! $success ) {
|
||||
return new WP_Error( 'failed_to_fetch_ai_responses', __( 'Failed to fetch AI responses.', 'woo-gutenberg-products-block' ) );
|
||||
return new WP_Error( 'failed_to_fetch_ai_responses', __( 'Failed to fetch AI responses.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
return $ai_responses;
|
||||
|
@ -421,7 +421,7 @@ class PatternUpdater {
|
|||
$patterns_dictionary = plugin_dir_path( __FILE__ ) . 'dictionary.json';
|
||||
|
||||
if ( ! file_exists( $patterns_dictionary ) ) {
|
||||
return new WP_Error( 'missing_patterns_dictionary', __( 'The patterns dictionary is missing.', 'woo-gutenberg-products-block' ) );
|
||||
return new WP_Error( 'missing_patterns_dictionary', __( 'The patterns dictionary is missing.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
return wp_json_file_decode( $patterns_dictionary, array( 'associative' => true ) );
|
||||
|
|
|
@ -143,13 +143,13 @@ class PatternsHelper {
|
|||
$patterns_dictionary_file = plugin_dir_path( __FILE__ ) . 'dictionary.json';
|
||||
|
||||
if ( ! file_exists( $patterns_dictionary_file ) ) {
|
||||
return new WP_Error( 'missing_patterns_dictionary', __( 'The patterns dictionary is missing.', 'woo-gutenberg-products-block' ) );
|
||||
return new WP_Error( 'missing_patterns_dictionary', __( 'The patterns dictionary is missing.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$default_patterns_dictionary = wp_json_file_decode( $patterns_dictionary_file, array( 'associative' => true ) );
|
||||
|
||||
if ( json_last_error() !== JSON_ERROR_NONE ) {
|
||||
return new WP_Error( 'json_decode_error', __( 'Error decoding JSON.', 'woo-gutenberg-products-block' ) );
|
||||
return new WP_Error( 'json_decode_error', __( 'Error decoding JSON.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$patterns_ai_data_post = self::get_patterns_ai_data_post();
|
||||
|
@ -158,7 +158,7 @@ class PatternsHelper {
|
|||
$patterns_dictionary = json_decode( $patterns_ai_data_post->post_content, true );
|
||||
|
||||
if ( json_last_error() !== JSON_ERROR_NONE ) {
|
||||
return new WP_Error( 'json_decode_error', __( 'Error decoding JSON.', 'woo-gutenberg-products-block' ) );
|
||||
return new WP_Error( 'json_decode_error', __( 'Error decoding JSON.', 'woocommerce' ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class ProductUpdater {
|
|||
}
|
||||
|
||||
if ( empty( $business_description ) ) {
|
||||
return new \WP_Error( 'missing_business_description', __( 'No business description provided for generating AI content.', 'woo-gutenberg-products-block' ) );
|
||||
return new \WP_Error( 'missing_business_description', __( 'No business description provided for generating AI content.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$last_business_description = get_option( 'last_business_description_with_ai_content_generated' );
|
||||
|
@ -78,7 +78,7 @@ class ProductUpdater {
|
|||
'product_content' => array(),
|
||||
);
|
||||
} else {
|
||||
return new \WP_Error( 'business_description_not_found', __( 'No business description provided for generating AI content.', 'woo-gutenberg-products-block' ) );
|
||||
return new \WP_Error( 'business_description_not_found', __( 'No business description provided for generating AI content.', 'woocommerce' ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ class ProductUpdater {
|
|||
// Identify dummy products that need to have their content updated.
|
||||
$dummy_products_ids = $this->fetch_product_ids( 'dummy' );
|
||||
if ( ! is_array( $dummy_products_ids ) ) {
|
||||
return new \WP_Error( 'failed_to_fetch_dummy_products', __( 'Failed to fetch dummy products.', 'woo-gutenberg-products-block' ) );
|
||||
return new \WP_Error( 'failed_to_fetch_dummy_products', __( 'Failed to fetch dummy products.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$dummy_products = array_map(
|
||||
|
@ -393,7 +393,7 @@ class ProductUpdater {
|
|||
*/
|
||||
public function assign_ai_generated_content_to_dummy_products( $ai_connection, $token, $products_information_list, $business_description ) {
|
||||
if ( empty( $business_description ) ) {
|
||||
return new \WP_Error( 'missing_store_description', __( 'The store description is required to generate content for your site.', 'woo-gutenberg-products-block' ) );
|
||||
return new \WP_Error( 'missing_store_description', __( 'The store description is required to generate content for your site.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$prompts = [];
|
||||
|
@ -470,7 +470,7 @@ class ProductUpdater {
|
|||
}
|
||||
|
||||
if ( ! $success ) {
|
||||
return new WP_Error( 'failed_to_fetch_ai_responses', __( 'Failed to fetch AI responses for products.', 'woo-gutenberg-products-block' ) );
|
||||
return new WP_Error( 'failed_to_fetch_ai_responses', __( 'Failed to fetch AI responses for products.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
return array(
|
||||
|
|
|
@ -27,8 +27,8 @@ class PickupLocation extends WC_Shipping_Method {
|
|||
*/
|
||||
public function __construct() {
|
||||
$this->id = 'pickup_location';
|
||||
$this->method_title = __( 'Local pickup', 'woo-gutenberg-products-block' );
|
||||
$this->method_description = __( 'Allow customers to choose a local pickup location during checkout.', 'woo-gutenberg-products-block' );
|
||||
$this->method_title = __( 'Local pickup', 'woocommerce' );
|
||||
$this->method_description = __( 'Allow customers to choose a local pickup location during checkout.', 'woocommerce' );
|
||||
$this->init();
|
||||
}
|
||||
|
||||
|
@ -141,9 +141,9 @@ class PickupLocation extends WC_Shipping_Method {
|
|||
}
|
||||
switch ( $name ) {
|
||||
case 'pickup_location':
|
||||
return __( 'Pickup location', 'woo-gutenberg-products-block' );
|
||||
return __( 'Pickup location', 'woocommerce' );
|
||||
case 'pickup_address':
|
||||
return __( 'Pickup address', 'woo-gutenberg-products-block' );
|
||||
return __( 'Pickup address', 'woocommerce' );
|
||||
}
|
||||
return $label;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ class PickupLocation extends WC_Shipping_Method {
|
|||
|
||||
wp_enqueue_script( 'wc-shipping-method-pickup-location' );
|
||||
|
||||
echo '<h2>' . esc_html__( 'Local pickup', 'woo-gutenberg-products-block' ) . '</h2>';
|
||||
echo '<h2>' . esc_html__( 'Local pickup', 'woocommerce' ) . '</h2>';
|
||||
echo '<div class="wrap"><div id="wc-shipping-method-pickup-location-settings-container"></div></div>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ class ShippingController {
|
|||
|
||||
return sprintf(
|
||||
// Translators: %s location name.
|
||||
__( 'Collection from <strong>%s</strong>:', 'woo-gutenberg-products-block' ),
|
||||
__( 'Collection from <strong>%s</strong>:', 'woocommerce' ),
|
||||
$location
|
||||
) . '<br/><address>' . str_replace( ',', ',<br/>', $address ) . '</address><br/>' . $details;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ class ShippingController {
|
|||
if ( CartCheckoutUtils::is_checkout_block_default() && $this->local_pickup_enabled ) {
|
||||
foreach ( $settings as $index => $setting ) {
|
||||
if ( 'woocommerce_shipping_cost_requires_address' === $setting['id'] ) {
|
||||
$settings[ $index ]['desc'] .= ' (' . __( 'Not available when using WooCommerce Blocks Local Pickup', 'woo-gutenberg-products-block' ) . ')';
|
||||
$settings[ $index ]['desc'] .= ' (' . __( 'Not available when using WooCommerce Blocks Local Pickup', 'woocommerce' ) . ')';
|
||||
$settings[ $index ]['disabled'] = true;
|
||||
$settings[ $index ]['value'] = 'no';
|
||||
break;
|
||||
|
@ -211,21 +211,21 @@ class ShippingController {
|
|||
'type' => 'object',
|
||||
'properties' => array(
|
||||
'enabled' => [
|
||||
'description' => __( 'If enabled, this method will appear on the block based checkout.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'If enabled, this method will appear on the block based checkout.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'enum' => [ 'yes', 'no' ],
|
||||
],
|
||||
'title' => [
|
||||
'description' => __( 'This controls the title which the user sees during checkout.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
],
|
||||
'tax_status' => [
|
||||
'description' => __( 'If a cost is defined, this controls if taxes are applied to that cost.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'If a cost is defined, this controls if taxes are applied to that cost.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'enum' => [ 'taxable', 'none' ],
|
||||
],
|
||||
'cost' => [
|
||||
'description' => __( 'Optional cost to charge for local pickup.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Optional cost to charge for local pickup.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
],
|
||||
),
|
||||
|
@ -494,7 +494,7 @@ class ShippingController {
|
|||
|
||||
$data = array(
|
||||
'local_pickup_enabled' => 'yes' === $settings['enabled'] ? true : false,
|
||||
'title' => __( 'Local Pickup', 'woo-gutenberg-products-block' ) === $settings['title'],
|
||||
'title' => __( 'Local Pickup', 'woocommerce' ) === $settings['title'],
|
||||
'price' => '' === $settings['cost'] ? true : false,
|
||||
'cost' => '' === $settings['cost'] ? 0 : $settings['cost'],
|
||||
'taxes' => $settings['tax_status'],
|
||||
|
|
|
@ -58,6 +58,6 @@ class OrderConfirmationTemplate extends AbstractPageTemplate {
|
|||
* @return string
|
||||
*/
|
||||
public static function get_template_title() {
|
||||
return __( 'Order Confirmation', 'woo-gutenberg-products-block' );
|
||||
return __( 'Order Confirmation', 'woocommerce' );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ class BlockTemplateUtils {
|
|||
}
|
||||
|
||||
if ( ! $terms ) {
|
||||
return new \WP_Error( 'template_missing_theme', __( 'No theme is defined for this template.', 'woo-gutenberg-products-block' ) );
|
||||
return new \WP_Error( 'template_missing_theme', __( 'No theme is defined for this template.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$theme = $terms[0]->name;
|
||||
|
@ -347,48 +347,48 @@ class BlockTemplateUtils {
|
|||
public static function get_plugin_block_template_types() {
|
||||
return array(
|
||||
'single-product' => array(
|
||||
'title' => _x( 'Single Product', 'Template name', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Displays a single product.', 'woo-gutenberg-products-block' ),
|
||||
'title' => _x( 'Single Product', 'Template name', 'woocommerce' ),
|
||||
'description' => __( 'Displays a single product.', 'woocommerce' ),
|
||||
),
|
||||
'archive-product' => array(
|
||||
'title' => _x( 'Product Catalog', 'Template name', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Displays your products.', 'woo-gutenberg-products-block' ),
|
||||
'title' => _x( 'Product Catalog', 'Template name', 'woocommerce' ),
|
||||
'description' => __( 'Displays your products.', 'woocommerce' ),
|
||||
),
|
||||
'taxonomy-product_cat' => array(
|
||||
'title' => _x( 'Products by Category', 'Template name', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Displays products filtered by a category.', 'woo-gutenberg-products-block' ),
|
||||
'title' => _x( 'Products by Category', 'Template name', 'woocommerce' ),
|
||||
'description' => __( 'Displays products filtered by a category.', 'woocommerce' ),
|
||||
),
|
||||
'taxonomy-product_tag' => array(
|
||||
'title' => _x( 'Products by Tag', 'Template name', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Displays products filtered by a tag.', 'woo-gutenberg-products-block' ),
|
||||
'title' => _x( 'Products by Tag', 'Template name', 'woocommerce' ),
|
||||
'description' => __( 'Displays products filtered by a tag.', 'woocommerce' ),
|
||||
),
|
||||
ProductAttributeTemplate::SLUG => array(
|
||||
'title' => _x( 'Products by Attribute', 'Template name', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Displays products filtered by an attribute.', 'woo-gutenberg-products-block' ),
|
||||
'title' => _x( 'Products by Attribute', 'Template name', 'woocommerce' ),
|
||||
'description' => __( 'Displays products filtered by an attribute.', 'woocommerce' ),
|
||||
),
|
||||
ProductSearchResultsTemplate::SLUG => array(
|
||||
'title' => _x( 'Product Search Results', 'Template name', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Displays search results for your store.', 'woo-gutenberg-products-block' ),
|
||||
'title' => _x( 'Product Search Results', 'Template name', 'woocommerce' ),
|
||||
'description' => __( 'Displays search results for your store.', 'woocommerce' ),
|
||||
),
|
||||
MiniCartTemplate::SLUG => array(
|
||||
'title' => _x( 'Mini-Cart', 'Template name', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Template used to display the Mini-Cart drawer.', 'woo-gutenberg-products-block' ),
|
||||
'title' => _x( 'Mini-Cart', 'Template name', 'woocommerce' ),
|
||||
'description' => __( 'Template used to display the Mini-Cart drawer.', 'woocommerce' ),
|
||||
),
|
||||
CartTemplate::get_slug() => array(
|
||||
'title' => _x( 'Page: Cart', 'Template name', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The Cart template displays the items selected by the user for purchase, including quantities, prices, and discounts. It allows users to review their choices before proceeding to checkout.', 'woo-gutenberg-products-block' ),
|
||||
'title' => _x( 'Page: Cart', 'Template name', 'woocommerce' ),
|
||||
'description' => __( 'The Cart template displays the items selected by the user for purchase, including quantities, prices, and discounts. It allows users to review their choices before proceeding to checkout.', 'woocommerce' ),
|
||||
),
|
||||
CheckoutTemplate::get_slug() => array(
|
||||
'title' => _x( 'Page: Checkout', 'Template name', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The Checkout template guides users through the final steps of the purchase process. It enables users to enter shipping and billing information, select a payment method, and review order details.', 'woo-gutenberg-products-block' ),
|
||||
'title' => _x( 'Page: Checkout', 'Template name', 'woocommerce' ),
|
||||
'description' => __( 'The Checkout template guides users through the final steps of the purchase process. It enables users to enter shipping and billing information, select a payment method, and review order details.', 'woocommerce' ),
|
||||
),
|
||||
CheckoutHeaderTemplate::SLUG => array(
|
||||
'title' => _x( 'Checkout Header', 'Template name', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Template used to display the simplified Checkout header.', 'woo-gutenberg-products-block' ),
|
||||
'title' => _x( 'Checkout Header', 'Template name', 'woocommerce' ),
|
||||
'description' => __( 'Template used to display the simplified Checkout header.', 'woocommerce' ),
|
||||
),
|
||||
OrderConfirmationTemplate::get_slug() => array(
|
||||
'title' => _x( 'Order Confirmation', 'Template name', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The Order Confirmation template serves as a receipt and confirmation of a successful purchase. It includes a summary of the ordered items, shipping, billing, and totals.', 'woo-gutenberg-products-block' ),
|
||||
'title' => _x( 'Order Confirmation', 'Template name', 'woocommerce' ),
|
||||
'description' => __( 'The Order Confirmation template serves as a receipt and confirmation of a successful purchase. It includes a summary of the ordered items, shipping, billing, and totals.', 'woocommerce' ),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ class BusinessDescription extends AbstractRoute {
|
|||
'permission_callback' => [ Middleware::class, 'is_authorized' ],
|
||||
'args' => [
|
||||
'business_description' => [
|
||||
'description' => __( 'The business description for a given store.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The business description for a given store.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
],
|
||||
],
|
||||
|
@ -71,7 +71,7 @@ class BusinessDescription extends AbstractRoute {
|
|||
return $this->error_to_response(
|
||||
new \WP_Error(
|
||||
'invalid_business_description',
|
||||
__( 'Invalid business description.', 'woo-gutenberg-products-block' )
|
||||
__( 'Invalid business description.', 'woocommerce' )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ class Images extends AbstractRoute {
|
|||
'permission_callback' => [ Middleware::class, 'is_authorized' ],
|
||||
'args' => [
|
||||
'business_description' => [
|
||||
'description' => __( 'The business description for a given store.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The business description for a given store.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
],
|
||||
],
|
||||
|
|
|
@ -21,7 +21,7 @@ class Middleware {
|
|||
public static function is_authorized() {
|
||||
try {
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
throw new RouteException( 'woocommerce_rest_invalid_user', __( 'You are not allowed to make this request. Please make sure you are logged in.', 'woo-gutenberg-products-block' ), 403 );
|
||||
throw new RouteException( 'woocommerce_rest_invalid_user', __( 'You are not allowed to make this request. Please make sure you are logged in.', 'woocommerce' ), 403 );
|
||||
}
|
||||
} catch ( RouteException $error ) {
|
||||
return new \WP_Error(
|
||||
|
@ -35,7 +35,7 @@ class Middleware {
|
|||
|
||||
if ( ! $allow_ai_connection ) {
|
||||
try {
|
||||
throw new RouteException( 'ai_connection_not_allowed', __( 'AI content generation is not allowed on this store. Update your store settings if you wish to enable this feature.', 'woo-gutenberg-products-block' ), 403 );
|
||||
throw new RouteException( 'ai_connection_not_allowed', __( 'AI content generation is not allowed on this store. Update your store settings if you wish to enable this feature.', 'woocommerce' ), 403 );
|
||||
} catch ( RouteException $error ) {
|
||||
return new \WP_Error(
|
||||
$error->getErrorCode(),
|
||||
|
|
|
@ -49,11 +49,11 @@ class Patterns extends AbstractRoute {
|
|||
'permission_callback' => [ Middleware::class, 'is_authorized' ],
|
||||
'args' => [
|
||||
'business_description' => [
|
||||
'description' => __( 'The business description for a given store.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The business description for a given store.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
],
|
||||
'images' => [
|
||||
'description' => __( 'The images for a given store.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The images for a given store.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
],
|
||||
],
|
||||
|
|
|
@ -47,11 +47,11 @@ class Product extends AbstractRoute {
|
|||
'permission_callback' => [ Middleware::class, 'is_authorized' ],
|
||||
'args' => [
|
||||
'products_information' => [
|
||||
'description' => __( 'Data generated by AI for updating dummy products.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Data generated by AI for updating dummy products.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
],
|
||||
'last_product' => [
|
||||
'description' => __( 'Whether the product being updated is the last one in the loop', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Whether the product being updated is the last one in the loop', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
],
|
||||
],
|
||||
|
|
|
@ -48,11 +48,11 @@ class Products extends AbstractRoute {
|
|||
'permission_callback' => [ Middleware::class, 'is_authorized' ],
|
||||
'args' => [
|
||||
'business_description' => [
|
||||
'description' => __( 'The business description for a given store.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The business description for a given store.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
],
|
||||
'images' => [
|
||||
'description' => __( 'The images for a given store.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The images for a given store.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
],
|
||||
],
|
||||
|
@ -82,7 +82,7 @@ class Products extends AbstractRoute {
|
|||
$this->error_to_response(
|
||||
new \WP_Error(
|
||||
'ai_connection_not_allowed',
|
||||
__( 'AI content generation is not allowed on this store. Update your store settings if you wish to enable this feature.', 'woo-gutenberg-products-block' )
|
||||
__( 'AI content generation is not allowed on this store. Update your store settings if you wish to enable this feature.', 'woocommerce' )
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -117,7 +117,7 @@ class Products extends AbstractRoute {
|
|||
}
|
||||
|
||||
if ( ! isset( $populate_products['product_content'] ) ) {
|
||||
return $this->error_to_response( new \WP_Error( 'product_content_not_found', __( 'Product content not found.', 'woo-gutenberg-products-block' ) ) );
|
||||
return $this->error_to_response( new \WP_Error( 'product_content_not_found', __( 'Product content not found.', 'woocommerce' ) ) );
|
||||
}
|
||||
|
||||
$product_content = $populate_products['product_content'];
|
||||
|
|
|
@ -61,7 +61,7 @@ class StoreTitle extends AbstractRoute {
|
|||
'permission_callback' => [ Middleware::class, 'is_authorized' ],
|
||||
'args' => [
|
||||
'business_description' => [
|
||||
'description' => __( 'The business description for a given store.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The business description for a given store.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
],
|
||||
],
|
||||
|
@ -86,7 +86,7 @@ class StoreTitle extends AbstractRoute {
|
|||
return $this->error_to_response(
|
||||
new \WP_Error(
|
||||
'invalid_business_description',
|
||||
__( 'Invalid business description.', 'woo-gutenberg-products-block' )
|
||||
__( 'Invalid business description.', 'woocommerce' )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -301,11 +301,11 @@ abstract class AbstractCartRoute extends AbstractRoute {
|
|||
}
|
||||
|
||||
if ( null === $nonce ) {
|
||||
return $this->get_route_error_response( 'woocommerce_rest_missing_nonce', __( 'Missing the Nonce header. This endpoint requires a valid nonce.', 'woo-gutenberg-products-block' ), 401 );
|
||||
return $this->get_route_error_response( 'woocommerce_rest_missing_nonce', __( 'Missing the Nonce header. This endpoint requires a valid nonce.', 'woocommerce' ), 401 );
|
||||
}
|
||||
|
||||
if ( ! wp_verify_nonce( $nonce, 'wc_store_api' ) ) {
|
||||
return $this->get_route_error_response( 'woocommerce_rest_invalid_nonce', __( 'Nonce is invalid.', 'woo-gutenberg-products-block' ), 403 );
|
||||
return $this->get_route_error_response( 'woocommerce_rest_invalid_nonce', __( 'Nonce is invalid.', 'woocommerce' ), 403 );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -166,7 +166,7 @@ abstract class AbstractRoute implements RouteInterface {
|
|||
* @return \WP_REST_Response
|
||||
*/
|
||||
protected function get_route_response( \WP_REST_Request $request ) {
|
||||
return $this->get_route_error_response( 'woocommerce_rest_invalid_endpoint', __( 'Method not implemented', 'woo-gutenberg-products-block' ), 404 );
|
||||
return $this->get_route_error_response( 'woocommerce_rest_invalid_endpoint', __( 'Method not implemented', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -179,7 +179,7 @@ abstract class AbstractRoute implements RouteInterface {
|
|||
* @return \WP_REST_Response
|
||||
*/
|
||||
protected function get_route_post_response( \WP_REST_Request $request ) {
|
||||
return $this->get_route_error_response( 'woocommerce_rest_invalid_endpoint', __( 'Method not implemented', 'woo-gutenberg-products-block' ), 404 );
|
||||
return $this->get_route_error_response( 'woocommerce_rest_invalid_endpoint', __( 'Method not implemented', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -192,7 +192,7 @@ abstract class AbstractRoute implements RouteInterface {
|
|||
* @return \WP_REST_Response
|
||||
*/
|
||||
protected function get_route_update_response( \WP_REST_Request $request ) {
|
||||
return $this->get_route_error_response( 'woocommerce_rest_invalid_endpoint', __( 'Method not implemented', 'woo-gutenberg-products-block' ), 404 );
|
||||
return $this->get_route_error_response( 'woocommerce_rest_invalid_endpoint', __( 'Method not implemented', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -205,7 +205,7 @@ abstract class AbstractRoute implements RouteInterface {
|
|||
* @return \WP_REST_Response
|
||||
*/
|
||||
protected function get_route_delete_response( \WP_REST_Request $request ) {
|
||||
return $this->get_route_error_response( 'woocommerce_rest_invalid_endpoint', __( 'Method not implemented', 'woo-gutenberg-products-block' ), 404 );
|
||||
return $this->get_route_error_response( 'woocommerce_rest_invalid_endpoint', __( 'Method not implemented', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -260,7 +260,7 @@ abstract class AbstractRoute implements RouteInterface {
|
|||
*/
|
||||
protected function get_context_param( $args = array() ) {
|
||||
$param_details = array(
|
||||
'description' => __( 'Scope under which the request is made; determines fields present in response.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Scope under which the request is made; determines fields present in response.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'sanitize_key',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
|
|
|
@ -26,7 +26,7 @@ abstract class AbstractTermsRoute extends AbstractRoute {
|
|||
$params['context']['default'] = 'view';
|
||||
|
||||
$params['page'] = array(
|
||||
'description' => __( 'Current page of the collection.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Current page of the collection.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'default' => 1,
|
||||
'sanitize_callback' => 'absint',
|
||||
|
@ -35,7 +35,7 @@ abstract class AbstractTermsRoute extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['per_page'] = array(
|
||||
'description' => __( 'Maximum number of items to be returned in result set. Defaults to no limit if left blank.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Maximum number of items to be returned in result set. Defaults to no limit if left blank.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'minimum' => 0,
|
||||
'maximum' => 100,
|
||||
|
@ -44,14 +44,14 @@ abstract class AbstractTermsRoute extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['search'] = array(
|
||||
'description' => __( 'Limit results to those matching a string.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit results to those matching a string.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
$params['exclude'] = array(
|
||||
'description' => __( 'Ensure result set excludes specific IDs.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'integer',
|
||||
|
@ -61,7 +61,7 @@ abstract class AbstractTermsRoute extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['include'] = array(
|
||||
'description' => __( 'Limit result set to specific ids.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to specific ids.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'integer',
|
||||
|
@ -71,7 +71,7 @@ abstract class AbstractTermsRoute extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['order'] = array(
|
||||
'description' => __( 'Sort ascending or descending.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Sort ascending or descending.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'default' => 'asc',
|
||||
'enum' => array( 'asc', 'desc' ),
|
||||
|
@ -79,7 +79,7 @@ abstract class AbstractTermsRoute extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['orderby'] = array(
|
||||
'description' => __( 'Sort by term property.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Sort by term property.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'default' => 'name',
|
||||
'enum' => array(
|
||||
|
@ -91,7 +91,7 @@ abstract class AbstractTermsRoute extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['hide_empty'] = array(
|
||||
'description' => __( 'If true, empty terms will not be returned.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'If true, empty terms will not be returned.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'default' => true,
|
||||
);
|
||||
|
|
|
@ -102,7 +102,7 @@ class Batch extends AbstractRoute implements RouteInterface {
|
|||
try {
|
||||
foreach ( $request['requests'] as $args ) {
|
||||
if ( ! stristr( $args['path'], 'wc/store' ) ) {
|
||||
throw new RouteException( 'woocommerce_rest_invalid_path', __( 'Invalid path provided.', 'woo-gutenberg-products-block' ), 400 );
|
||||
throw new RouteException( 'woocommerce_rest_invalid_path', __( 'Invalid path provided.', 'woocommerce' ), 400 );
|
||||
}
|
||||
}
|
||||
$response = rest_get_server()->serve_batch_request_v1( $request );
|
||||
|
|
|
@ -36,13 +36,13 @@ class CartAddItem extends AbstractCartRoute {
|
|||
'permission_callback' => '__return_true',
|
||||
'args' => [
|
||||
'id' => [
|
||||
'description' => __( 'The cart item product or variation ID.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The cart item product or variation ID.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'sanitize_callback' => 'absint',
|
||||
],
|
||||
'quantity' => [
|
||||
'description' => __( 'Quantity of this item to add to the cart.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Quantity of this item to add to the cart.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'arg_options' => [
|
||||
|
@ -50,19 +50,19 @@ class CartAddItem extends AbstractCartRoute {
|
|||
],
|
||||
],
|
||||
'variation' => [
|
||||
'description' => __( 'Chosen attributes (for variations).', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Chosen attributes (for variations).', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'items' => [
|
||||
'type' => 'object',
|
||||
'properties' => [
|
||||
'attribute' => [
|
||||
'description' => __( 'Variation attribute name.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Variation attribute name.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
'value' => [
|
||||
'description' => __( 'Variation attribute value.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Variation attribute value.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
|
@ -86,7 +86,7 @@ class CartAddItem extends AbstractCartRoute {
|
|||
protected function get_route_post_response( \WP_REST_Request $request ) {
|
||||
// Do not allow key to be specified during creation.
|
||||
if ( ! empty( $request['key'] ) ) {
|
||||
throw new RouteException( 'woocommerce_rest_cart_item_exists', __( 'Cannot create an existing cart item.', 'woo-gutenberg-products-block' ), 400 );
|
||||
throw new RouteException( 'woocommerce_rest_cart_item_exists', __( 'Cannot create an existing cart item.', 'woocommerce' ), 400 );
|
||||
}
|
||||
|
||||
$cart = $this->cart_controller->get_cart_instance();
|
||||
|
|
|
@ -36,7 +36,7 @@ class CartApplyCoupon extends AbstractCartRoute {
|
|||
'permission_callback' => '__return_true',
|
||||
'args' => [
|
||||
'code' => [
|
||||
'description' => __( 'Unique identifier for the coupon within the cart.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the coupon within the cart.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
],
|
||||
],
|
||||
|
@ -55,7 +55,7 @@ class CartApplyCoupon extends AbstractCartRoute {
|
|||
*/
|
||||
protected function get_route_post_response( \WP_REST_Request $request ) {
|
||||
if ( ! wc_coupons_enabled() ) {
|
||||
throw new RouteException( 'woocommerce_rest_cart_coupon_disabled', __( 'Coupons are disabled.', 'woo-gutenberg-products-block' ), 404 );
|
||||
throw new RouteException( 'woocommerce_rest_cart_coupon_disabled', __( 'Coupons are disabled.', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
$cart = $this->cart_controller->get_cart_instance();
|
||||
|
|
|
@ -94,7 +94,7 @@ class CartCoupons extends AbstractCartRoute {
|
|||
*/
|
||||
protected function get_route_post_response( \WP_REST_Request $request ) {
|
||||
if ( ! wc_coupons_enabled() ) {
|
||||
throw new RouteException( 'woocommerce_rest_cart_coupon_disabled', __( 'Coupons are disabled.', 'woo-gutenberg-products-block' ), 404 );
|
||||
throw new RouteException( 'woocommerce_rest_cart_coupon_disabled', __( 'Coupons are disabled.', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -39,7 +39,7 @@ class CartCouponsByCode extends AbstractCartRoute {
|
|||
return [
|
||||
'args' => [
|
||||
'code' => [
|
||||
'description' => __( 'Unique identifier for the coupon within the cart.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the coupon within the cart.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
],
|
||||
],
|
||||
|
@ -70,7 +70,7 @@ class CartCouponsByCode extends AbstractCartRoute {
|
|||
*/
|
||||
protected function get_route_response( \WP_REST_Request $request ) {
|
||||
if ( ! $this->cart_controller->has_coupon( $request['code'] ) ) {
|
||||
throw new RouteException( 'woocommerce_rest_cart_coupon_invalid_code', __( 'Coupon does not exist in the cart.', 'woo-gutenberg-products-block' ), 404 );
|
||||
throw new RouteException( 'woocommerce_rest_cart_coupon_invalid_code', __( 'Coupon does not exist in the cart.', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
return $this->prepare_item_for_response( $request['code'], $request );
|
||||
|
@ -85,7 +85,7 @@ class CartCouponsByCode extends AbstractCartRoute {
|
|||
*/
|
||||
protected function get_route_delete_response( \WP_REST_Request $request ) {
|
||||
if ( ! $this->cart_controller->has_coupon( $request['code'] ) ) {
|
||||
throw new RouteException( 'woocommerce_rest_cart_coupon_invalid_code', __( 'Coupon does not exist in the cart.', 'woo-gutenberg-products-block' ), 404 );
|
||||
throw new RouteException( 'woocommerce_rest_cart_coupon_invalid_code', __( 'Coupon does not exist in the cart.', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
$cart = $this->cart_controller->get_cart_instance();
|
||||
|
|
|
@ -43,11 +43,11 @@ class CartExtensions extends AbstractCartRoute {
|
|||
'permission_callback' => '__return_true',
|
||||
'args' => [
|
||||
'namespace' => [
|
||||
'description' => __( 'Extension\'s name - this will be used to ensure the data in the request is routed appropriately.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Extension\'s name - this will be used to ensure the data in the request is routed appropriately.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
],
|
||||
'data' => [
|
||||
'description' => __( 'Additional data to pass to the extension', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Additional data to pass to the extension', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
],
|
||||
],
|
||||
|
|
|
@ -92,7 +92,7 @@ class CartItems extends AbstractCartRoute {
|
|||
protected function get_route_post_response( \WP_REST_Request $request ) {
|
||||
// Do not allow key to be specified during creation.
|
||||
if ( ! empty( $request['key'] ) ) {
|
||||
throw new RouteException( 'woocommerce_rest_cart_item_exists', __( 'Cannot create an existing cart item.', 'woo-gutenberg-products-block' ), 400 );
|
||||
throw new RouteException( 'woocommerce_rest_cart_item_exists', __( 'Cannot create an existing cart item.', 'woocommerce' ), 400 );
|
||||
}
|
||||
|
||||
$result = $this->cart_controller->add_to_cart(
|
||||
|
|
|
@ -39,7 +39,7 @@ class CartItemsByKey extends AbstractCartRoute {
|
|||
return [
|
||||
'args' => [
|
||||
'key' => [
|
||||
'description' => __( 'Unique identifier for the item within the cart.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the item within the cart.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
],
|
||||
],
|
||||
|
@ -78,7 +78,7 @@ class CartItemsByKey extends AbstractCartRoute {
|
|||
$cart_item = $this->cart_controller->get_cart_item( $request['key'] );
|
||||
|
||||
if ( empty( $cart_item ) ) {
|
||||
throw new RouteException( 'woocommerce_rest_cart_invalid_key', __( 'Cart item does not exist.', 'woo-gutenberg-products-block' ), 409 );
|
||||
throw new RouteException( 'woocommerce_rest_cart_invalid_key', __( 'Cart item does not exist.', 'woocommerce' ), 409 );
|
||||
}
|
||||
|
||||
$data = $this->prepare_item_for_response( $cart_item, $request );
|
||||
|
@ -116,7 +116,7 @@ class CartItemsByKey extends AbstractCartRoute {
|
|||
$cart_item = $this->cart_controller->get_cart_item( $request['key'] );
|
||||
|
||||
if ( empty( $cart_item ) ) {
|
||||
throw new RouteException( 'woocommerce_rest_cart_invalid_key', __( 'Cart item does not exist.', 'woo-gutenberg-products-block' ), 409 );
|
||||
throw new RouteException( 'woocommerce_rest_cart_invalid_key', __( 'Cart item does not exist.', 'woocommerce' ), 409 );
|
||||
}
|
||||
|
||||
$cart->remove_cart_item( $request['key'] );
|
||||
|
|
|
@ -36,7 +36,7 @@ class CartRemoveCoupon extends AbstractCartRoute {
|
|||
'permission_callback' => '__return_true',
|
||||
'args' => [
|
||||
'code' => [
|
||||
'description' => __( 'Unique identifier for the coupon within the cart.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the coupon within the cart.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
],
|
||||
],
|
||||
|
@ -55,7 +55,7 @@ class CartRemoveCoupon extends AbstractCartRoute {
|
|||
*/
|
||||
protected function get_route_post_response( \WP_REST_Request $request ) {
|
||||
if ( ! wc_coupons_enabled() ) {
|
||||
throw new RouteException( 'woocommerce_rest_cart_coupon_disabled', __( 'Coupons are disabled.', 'woo-gutenberg-products-block' ), 404 );
|
||||
throw new RouteException( 'woocommerce_rest_cart_coupon_disabled', __( 'Coupons are disabled.', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
$cart = $this->cart_controller->get_cart_instance();
|
||||
|
@ -63,11 +63,11 @@ class CartRemoveCoupon extends AbstractCartRoute {
|
|||
$coupon = new \WC_Coupon( $coupon_code );
|
||||
|
||||
if ( $coupon->get_code() !== $coupon_code || ! $coupon->is_valid() ) {
|
||||
throw new RouteException( 'woocommerce_rest_cart_coupon_error', __( 'Invalid coupon code.', 'woo-gutenberg-products-block' ), 400 );
|
||||
throw new RouteException( 'woocommerce_rest_cart_coupon_error', __( 'Invalid coupon code.', 'woocommerce' ), 400 );
|
||||
}
|
||||
|
||||
if ( ! $this->cart_controller->has_coupon( $coupon_code ) ) {
|
||||
throw new RouteException( 'woocommerce_rest_cart_coupon_invalid_code', __( 'Coupon cannot be removed because it is not already applied to the cart.', 'woo-gutenberg-products-block' ), 409 );
|
||||
throw new RouteException( 'woocommerce_rest_cart_coupon_invalid_code', __( 'Coupon cannot be removed because it is not already applied to the cart.', 'woocommerce' ), 409 );
|
||||
}
|
||||
|
||||
$cart = $this->cart_controller->get_cart_instance();
|
||||
|
|
|
@ -39,7 +39,7 @@ class CartRemoveItem extends AbstractCartRoute {
|
|||
'permission_callback' => '__return_true',
|
||||
'args' => [
|
||||
'key' => [
|
||||
'description' => __( 'Unique identifier (key) for the cart item.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier (key) for the cart item.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
],
|
||||
],
|
||||
|
@ -61,7 +61,7 @@ class CartRemoveItem extends AbstractCartRoute {
|
|||
$cart_item = $this->cart_controller->get_cart_item( $request['key'] );
|
||||
|
||||
if ( empty( $cart_item ) ) {
|
||||
throw new RouteException( 'woocommerce_rest_cart_invalid_key', __( 'Cart item no longer exists or is invalid.', 'woo-gutenberg-products-block' ), 409 );
|
||||
throw new RouteException( 'woocommerce_rest_cart_invalid_key', __( 'Cart item no longer exists or is invalid.', 'woocommerce' ), 409 );
|
||||
}
|
||||
|
||||
$cart->remove_cart_item( $request['key'] );
|
||||
|
|
|
@ -36,12 +36,12 @@ class CartSelectShippingRate extends AbstractCartRoute {
|
|||
'permission_callback' => '__return_true',
|
||||
'args' => [
|
||||
'package_id' => array(
|
||||
'description' => __( 'The ID of the package being shipped. Leave blank to apply to all packages.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The ID of the package being shipped. Leave blank to apply to all packages.', 'woocommerce' ),
|
||||
'type' => [ 'integer', 'string', 'null' ],
|
||||
'required' => false,
|
||||
),
|
||||
'rate_id' => [
|
||||
'description' => __( 'The chosen rate ID for the package.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The chosen rate ID for the package.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'required' => true,
|
||||
],
|
||||
|
@ -61,11 +61,11 @@ class CartSelectShippingRate extends AbstractCartRoute {
|
|||
*/
|
||||
protected function get_route_post_response( \WP_REST_Request $request ) {
|
||||
if ( ! wc_shipping_enabled() ) {
|
||||
throw new RouteException( 'woocommerce_rest_shipping_disabled', __( 'Shipping is disabled.', 'woo-gutenberg-products-block' ), 404 );
|
||||
throw new RouteException( 'woocommerce_rest_shipping_disabled', __( 'Shipping is disabled.', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
if ( ! isset( $request['rate_id'] ) ) {
|
||||
throw new RouteException( 'woocommerce_rest_cart_missing_rate_id', __( 'Invalid Rate ID.', 'woo-gutenberg-products-block' ), 400 );
|
||||
throw new RouteException( 'woocommerce_rest_cart_missing_rate_id', __( 'Invalid Rate ID.', 'woocommerce' ), 400 );
|
||||
}
|
||||
|
||||
$cart = $this->cart_controller->get_cart_instance();
|
||||
|
|
|
@ -41,14 +41,14 @@ class CartUpdateCustomer extends AbstractCartRoute {
|
|||
'permission_callback' => '__return_true',
|
||||
'args' => [
|
||||
'billing_address' => [
|
||||
'description' => __( 'Billing address.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Billing address.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'properties' => $this->schema->billing_address_schema->get_properties(),
|
||||
'sanitize_callback' => null,
|
||||
],
|
||||
'shipping_address' => [
|
||||
'description' => __( 'Shipping address.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Shipping address.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'properties' => $this->schema->shipping_address_schema->get_properties(),
|
||||
|
@ -79,7 +79,7 @@ class CartUpdateCustomer extends AbstractCartRoute {
|
|||
$billing_validation_check = $this->schema->billing_address_schema->validate_callback( $billing, $request, 'billing_address' );
|
||||
|
||||
if ( false === $billing_validation_check ) {
|
||||
$invalid_params['billing_address'] = __( 'Invalid parameter.', 'woo-gutenberg-products-block' );
|
||||
$invalid_params['billing_address'] = __( 'Invalid parameter.', 'woocommerce' );
|
||||
} elseif ( is_wp_error( $billing_validation_check ) ) {
|
||||
$invalid_params['billing_address'] = implode( ' ', $billing_validation_check->get_error_messages() );
|
||||
$invalid_details['billing_address'] = \rest_convert_error_to_response( $billing_validation_check )->get_data();
|
||||
|
@ -90,7 +90,7 @@ class CartUpdateCustomer extends AbstractCartRoute {
|
|||
$shipping_validation_check = $this->schema->shipping_address_schema->validate_callback( $shipping, $request, 'shipping_address' );
|
||||
|
||||
if ( false === $shipping_validation_check ) {
|
||||
$invalid_params['shipping_address'] = __( 'Invalid parameter.', 'woo-gutenberg-products-block' );
|
||||
$invalid_params['shipping_address'] = __( 'Invalid parameter.', 'woocommerce' );
|
||||
} elseif ( is_wp_error( $shipping_validation_check ) ) {
|
||||
$invalid_params['shipping_address'] = implode( ' ', $shipping_validation_check->get_error_messages() );
|
||||
$invalid_details['shipping_address'] = \rest_convert_error_to_response( $shipping_validation_check )->get_data();
|
||||
|
@ -101,7 +101,7 @@ class CartUpdateCustomer extends AbstractCartRoute {
|
|||
return new \WP_Error(
|
||||
'rest_invalid_param',
|
||||
/* translators: %s: List of invalid parameters. */
|
||||
sprintf( __( 'Invalid parameter(s): %s', 'woo-gutenberg-products-block' ), implode( ', ', array_keys( $invalid_params ) ) ),
|
||||
sprintf( __( 'Invalid parameter(s): %s', 'woocommerce' ), implode( ', ', array_keys( $invalid_params ) ) ),
|
||||
[
|
||||
'status' => 400,
|
||||
'params' => $invalid_params,
|
||||
|
|
|
@ -34,11 +34,11 @@ class CartUpdateItem extends AbstractCartRoute {
|
|||
'permission_callback' => '__return_true',
|
||||
'args' => [
|
||||
'key' => [
|
||||
'description' => __( 'Unique identifier (key) for the cart item to update.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier (key) for the cart item to update.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
],
|
||||
'quantity' => [
|
||||
'description' => __( 'New quantity of the item in the cart.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'New quantity of the item in the cart.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
],
|
||||
],
|
||||
|
|
|
@ -79,7 +79,7 @@ class Checkout extends AbstractCartRoute {
|
|||
'args' => array_merge(
|
||||
[
|
||||
'payment_data' => [
|
||||
'description' => __( 'Data to pass through to the payment method when processing payment.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Data to pass through to the payment method when processing payment.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'items' => [
|
||||
'type' => 'object',
|
||||
|
@ -376,7 +376,7 @@ class Checkout extends AbstractCartRoute {
|
|||
if ( ! $this->order instanceof \WC_Order ) {
|
||||
throw new RouteException(
|
||||
'woocommerce_rest_checkout_missing_order',
|
||||
__( 'Unable to create order', 'woo-gutenberg-products-block' ),
|
||||
__( 'Unable to create order', 'woocommerce' ),
|
||||
500
|
||||
);
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ class Checkout extends AbstractCartRoute {
|
|||
if ( $requires_payment_method ) {
|
||||
throw new RouteException(
|
||||
'woocommerce_rest_checkout_missing_payment_method',
|
||||
__( 'No payment method provided.', 'woo-gutenberg-products-block' ),
|
||||
__( 'No payment method provided.', 'woocommerce' ),
|
||||
400
|
||||
);
|
||||
}
|
||||
|
@ -474,7 +474,7 @@ class Checkout extends AbstractCartRoute {
|
|||
'woocommerce_rest_checkout_payment_method_disabled',
|
||||
sprintf(
|
||||
// Translators: %s Payment method ID.
|
||||
__( '%s is not available for this order—please choose a different payment method', 'woo-gutenberg-products-block' ),
|
||||
__( '%s is not available for this order—please choose a different payment method', 'woocommerce' ),
|
||||
esc_html( $gateway_title )
|
||||
),
|
||||
400
|
||||
|
@ -522,13 +522,13 @@ class Checkout extends AbstractCartRoute {
|
|||
case 'registration-error-invalid-email':
|
||||
throw new RouteException(
|
||||
'registration-error-invalid-email',
|
||||
__( 'Please provide a valid email address.', 'woo-gutenberg-products-block' ),
|
||||
__( 'Please provide a valid email address.', 'woocommerce' ),
|
||||
400
|
||||
);
|
||||
case 'registration-error-email-exists':
|
||||
throw new RouteException(
|
||||
'registration-error-email-exists',
|
||||
__( 'An account is already registered with your email address. Please log in before proceeding.', 'woo-gutenberg-products-block' ),
|
||||
__( 'An account is already registered with your email address. Please log in before proceeding.', 'woocommerce' ),
|
||||
400
|
||||
);
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ class CheckoutOrder extends AbstractCartRoute {
|
|||
'args' => array_merge(
|
||||
[
|
||||
'payment_data' => [
|
||||
'description' => __( 'Data to pass through to the payment method when processing payment.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Data to pass through to the payment method when processing payment.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'items' => [
|
||||
'type' => 'object',
|
||||
|
@ -103,7 +103,7 @@ class CheckoutOrder extends AbstractCartRoute {
|
|||
if ( ! $this->order || ! $this->order->needs_payment() ) {
|
||||
return new \WP_Error(
|
||||
'invalid_order_update_status',
|
||||
__( 'This order cannot be paid for.', 'woo-gutenberg-products-block' )
|
||||
__( 'This order cannot be paid for.', 'woocommerce' )
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ class CheckoutOrder extends AbstractCartRoute {
|
|||
if ( $requires_payment_method ) {
|
||||
throw new RouteException(
|
||||
'woocommerce_rest_checkout_missing_payment_method',
|
||||
__( 'No payment method provided.', 'woo-gutenberg-products-block' ),
|
||||
__( 'No payment method provided.', 'woocommerce' ),
|
||||
400
|
||||
);
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ class CheckoutOrder extends AbstractCartRoute {
|
|||
'woocommerce_rest_checkout_payment_method_disabled',
|
||||
sprintf(
|
||||
// Translators: %s Payment method ID.
|
||||
__( 'The %s payment gateway is not available.', 'woo-gutenberg-products-block' ),
|
||||
__( 'The %s payment gateway is not available.', 'woocommerce' ),
|
||||
esc_html( $request_payment_method )
|
||||
),
|
||||
400
|
||||
|
|
|
@ -32,7 +32,7 @@ class ProductAttributeTerms extends AbstractTermsRoute {
|
|||
return [
|
||||
'args' => array(
|
||||
'attribute_id' => array(
|
||||
'description' => __( 'Unique identifier for the attribute.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the attribute.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
|
@ -68,7 +68,7 @@ class ProductAttributeTerms extends AbstractTermsRoute {
|
|||
$attribute = wc_get_attribute( $request['attribute_id'] );
|
||||
|
||||
if ( ! $attribute || ! taxonomy_exists( $attribute->slug ) ) {
|
||||
throw new RouteException( 'woocommerce_rest_taxonomy_invalid', __( 'Attribute does not exist.', 'woo-gutenberg-products-block' ), 404 );
|
||||
throw new RouteException( 'woocommerce_rest_taxonomy_invalid', __( 'Attribute does not exist.', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
return $this->get_terms_response( $attribute->slug, $request );
|
||||
|
|
|
@ -39,7 +39,7 @@ class ProductAttributesById extends AbstractRoute {
|
|||
return [
|
||||
'args' => array(
|
||||
'id' => array(
|
||||
'description' => __( 'Unique identifier for the resource.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
|
@ -70,7 +70,7 @@ class ProductAttributesById extends AbstractRoute {
|
|||
$object = wc_get_attribute( (int) $request['id'] );
|
||||
|
||||
if ( ! $object || 0 === $object->id ) {
|
||||
throw new RouteException( 'woocommerce_rest_attribute_invalid_id', __( 'Invalid attribute ID.', 'woo-gutenberg-products-block' ), 404 );
|
||||
throw new RouteException( 'woocommerce_rest_attribute_invalid_id', __( 'Invalid attribute ID.', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
$data = $this->prepare_item_for_response( $object, $request );
|
||||
|
|
|
@ -39,7 +39,7 @@ class ProductCategoriesById extends AbstractRoute {
|
|||
return [
|
||||
'args' => array(
|
||||
'id' => array(
|
||||
'description' => __( 'Unique identifier for the resource.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
|
@ -70,7 +70,7 @@ class ProductCategoriesById extends AbstractRoute {
|
|||
$object = get_term( (int) $request['id'], 'product_cat' );
|
||||
|
||||
if ( ! $object || 0 === $object->id ) {
|
||||
throw new RouteException( 'woocommerce_rest_category_invalid_id', __( 'Invalid category ID.', 'woo-gutenberg-products-block' ), 404 );
|
||||
throw new RouteException( 'woocommerce_rest_category_invalid_id', __( 'Invalid category ID.', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
$data = $this->prepare_item_for_response( $object, $request );
|
||||
|
|
|
@ -132,31 +132,31 @@ class ProductCollectionData extends AbstractRoute {
|
|||
$params = ( new Products( $this->schema_controller, $this->schema ) )->get_collection_params();
|
||||
|
||||
$params['calculate_price_range'] = [
|
||||
'description' => __( 'If true, calculates the minimum and maximum product prices for the collection.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'If true, calculates the minimum and maximum product prices for the collection.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
];
|
||||
|
||||
$params['calculate_stock_status_counts'] = [
|
||||
'description' => __( 'If true, calculates stock counts for products in the collection.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'If true, calculates stock counts for products in the collection.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
];
|
||||
|
||||
$params['calculate_attribute_counts'] = [
|
||||
'description' => __( 'If requested, calculates attribute term counts for products in the collection.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'If requested, calculates attribute term counts for products in the collection.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'items' => [
|
||||
'type' => 'object',
|
||||
'properties' => [
|
||||
'taxonomy' => [
|
||||
'description' => __( 'Taxonomy name.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Taxonomy name.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'query_type' => [
|
||||
'description' => __( 'Filter condition being performed which may affect counts. Valid values include "and" and "or".', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Filter condition being performed which may affect counts. Valid values include "and" and "or".', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'enum' => [ 'and', 'or' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
|
@ -168,7 +168,7 @@ class ProductCollectionData extends AbstractRoute {
|
|||
];
|
||||
|
||||
$params['calculate_rating_counts'] = [
|
||||
'description' => __( 'If true, calculates rating counts for products in the collection.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'If true, calculates rating counts for products in the collection.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
];
|
||||
|
|
|
@ -165,7 +165,7 @@ class ProductReviews extends AbstractRoute {
|
|||
$params['context']['default'] = 'view';
|
||||
|
||||
$params['page'] = array(
|
||||
'description' => __( 'Current page of the collection.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Current page of the collection.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'default' => 1,
|
||||
'sanitize_callback' => 'absint',
|
||||
|
@ -174,7 +174,7 @@ class ProductReviews extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['per_page'] = array(
|
||||
'description' => __( 'Maximum number of items to be returned in result set. Defaults to no limit if left blank.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Maximum number of items to be returned in result set. Defaults to no limit if left blank.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'default' => 10,
|
||||
'minimum' => 0,
|
||||
|
@ -184,14 +184,14 @@ class ProductReviews extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['offset'] = array(
|
||||
'description' => __( 'Offset the result set by a specific number of items.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'sanitize_callback' => 'absint',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
$params['order'] = array(
|
||||
'description' => __( 'Order sort attribute ascending or descending.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'default' => 'desc',
|
||||
'enum' => array( 'asc', 'desc' ),
|
||||
|
@ -199,7 +199,7 @@ class ProductReviews extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['orderby'] = array(
|
||||
'description' => __( 'Sort collection by object attribute.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'default' => 'date',
|
||||
'enum' => array(
|
||||
|
@ -213,14 +213,14 @@ class ProductReviews extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['category_id'] = array(
|
||||
'description' => __( 'Limit result set to reviews from specific category IDs.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to reviews from specific category IDs.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'wp_parse_id_list',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
$params['product_id'] = array(
|
||||
'description' => __( 'Limit result set to reviews from specific product IDs.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to reviews from specific product IDs.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'wp_parse_id_list',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
|
|
|
@ -116,7 +116,7 @@ class Products extends AbstractRoute {
|
|||
$params['context']['default'] = 'view';
|
||||
|
||||
$params['page'] = array(
|
||||
'description' => __( 'Current page of the collection.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Current page of the collection.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'default' => 1,
|
||||
'sanitize_callback' => 'absint',
|
||||
|
@ -125,7 +125,7 @@ class Products extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['per_page'] = array(
|
||||
'description' => __( 'Maximum number of items to be returned in result set. Defaults to no limit if left blank.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Maximum number of items to be returned in result set. Defaults to no limit if left blank.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'default' => 10,
|
||||
'minimum' => 0,
|
||||
|
@ -135,35 +135,35 @@ class Products extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['search'] = array(
|
||||
'description' => __( 'Limit results to those matching a string.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit results to those matching a string.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
$params['slug'] = array(
|
||||
'description' => __( 'Limit result set to products with specific slug(s). Use commas to separate.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to products with specific slug(s). Use commas to separate.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
$params['after'] = array(
|
||||
'description' => __( 'Limit response to resources created after a given ISO8601 compliant date.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit response to resources created after a given ISO8601 compliant date.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'format' => 'date-time',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
$params['before'] = array(
|
||||
'description' => __( 'Limit response to resources created before a given ISO8601 compliant date.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit response to resources created before a given ISO8601 compliant date.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'format' => 'date-time',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
$params['date_column'] = array(
|
||||
'description' => __( 'When limiting response using after/before, which date column to compare against.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'When limiting response using after/before, which date column to compare against.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'default' => 'date',
|
||||
'enum' => array(
|
||||
|
@ -176,7 +176,7 @@ class Products extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['exclude'] = array(
|
||||
'description' => __( 'Ensure result set excludes specific IDs.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'integer',
|
||||
|
@ -186,7 +186,7 @@ class Products extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['include'] = array(
|
||||
'description' => __( 'Limit result set to specific ids.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to specific ids.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'integer',
|
||||
|
@ -196,14 +196,14 @@ class Products extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['offset'] = array(
|
||||
'description' => __( 'Offset the result set by a specific number of items.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'sanitize_callback' => 'absint',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
$params['order'] = array(
|
||||
'description' => __( 'Order sort attribute ascending or descending.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'default' => 'desc',
|
||||
'enum' => array( 'asc', 'desc' ),
|
||||
|
@ -211,7 +211,7 @@ class Products extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['orderby'] = array(
|
||||
'description' => __( 'Sort collection by object attribute.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'default' => 'date',
|
||||
'enum' => array(
|
||||
|
@ -231,7 +231,7 @@ class Products extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['parent'] = array(
|
||||
'description' => __( 'Limit result set to those of particular parent IDs.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to those of particular parent IDs.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'integer',
|
||||
|
@ -241,7 +241,7 @@ class Products extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['parent_exclude'] = array(
|
||||
'description' => __( 'Limit result set to all items except those of a particular parent ID.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to all items except those of a particular parent ID.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'integer',
|
||||
|
@ -251,7 +251,7 @@ class Products extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['type'] = array(
|
||||
'description' => __( 'Limit result set to products assigned a specific type.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to products assigned a specific type.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'enum' => array_merge( array_keys( wc_get_product_types() ), [ 'variation' ] ),
|
||||
'sanitize_callback' => 'sanitize_key',
|
||||
|
@ -259,28 +259,28 @@ class Products extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['sku'] = array(
|
||||
'description' => __( 'Limit result set to products with specific SKU(s). Use commas to separate.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to products with specific SKU(s). Use commas to separate.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
$params['featured'] = array(
|
||||
'description' => __( 'Limit result set to featured products.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to featured products.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'sanitize_callback' => 'wc_string_to_bool',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
$params['category'] = array(
|
||||
'description' => __( 'Limit result set to products assigned a specific category ID.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to products assigned a specific category ID.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'wp_parse_id_list',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
$params['category_operator'] = array(
|
||||
'description' => __( 'Operator to compare product category terms.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Operator to compare product category terms.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'enum' => [ 'in', 'not_in', 'and' ],
|
||||
'default' => 'in',
|
||||
|
@ -292,7 +292,7 @@ class Products extends AbstractRoute {
|
|||
foreach ( $_REQUEST as $param => $value ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
if ( str_starts_with( $param, '_unstable_tax_' ) && ! str_ends_with( $param, '_operator' ) ) {
|
||||
$params[ $param ] = array(
|
||||
'description' => __( 'Limit result set to products assigned a specific category ID.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to products assigned a specific category ID.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'wp_parse_id_list',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
|
@ -300,7 +300,7 @@ class Products extends AbstractRoute {
|
|||
}
|
||||
if ( str_starts_with( $param, '_unstable_tax_' ) && str_ends_with( $param, '_operator' ) ) {
|
||||
$params[ $param ] = array(
|
||||
'description' => __( 'Operator to compare product category terms.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Operator to compare product category terms.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'enum' => [ 'in', 'not_in', 'and' ],
|
||||
'default' => 'in',
|
||||
|
@ -311,14 +311,14 @@ class Products extends AbstractRoute {
|
|||
}
|
||||
|
||||
$params['tag'] = array(
|
||||
'description' => __( 'Limit result set to products assigned a specific tag ID.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to products assigned a specific tag ID.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'wp_parse_id_list',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
$params['tag_operator'] = array(
|
||||
'description' => __( 'Operator to compare product tags.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Operator to compare product tags.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'enum' => [ 'in', 'not_in', 'and' ],
|
||||
'default' => 'in',
|
||||
|
@ -327,28 +327,28 @@ class Products extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['on_sale'] = array(
|
||||
'description' => __( 'Limit result set to products on sale.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to products on sale.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'sanitize_callback' => 'wc_string_to_bool',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
$params['min_price'] = array(
|
||||
'description' => __( 'Limit result set to products based on a minimum price, provided using the smallest unit of the currency.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to products based on a minimum price, provided using the smallest unit of the currency.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
$params['max_price'] = array(
|
||||
'description' => __( 'Limit result set to products based on a maximum price, provided using the smallest unit of the currency.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to products based on a maximum price, provided using the smallest unit of the currency.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'validate_callback' => 'rest_validate_request_arg',
|
||||
);
|
||||
|
||||
$params['stock_status'] = array(
|
||||
'description' => __( 'Limit result set to products with specified stock status.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to products with specified stock status.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'string',
|
||||
|
@ -360,18 +360,18 @@ class Products extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['attributes'] = array(
|
||||
'description' => __( 'Limit result set to products with selected global attributes.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to products with selected global attributes.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'object',
|
||||
'properties' => array(
|
||||
'attribute' => array(
|
||||
'description' => __( 'Attribute taxonomy name.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Attribute taxonomy name.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'sanitize_callback' => 'wc_sanitize_taxonomy_name',
|
||||
),
|
||||
'term_id' => array(
|
||||
'description' => __( 'List of attribute term IDs.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of attribute term IDs.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'items' => [
|
||||
'type' => 'integer',
|
||||
|
@ -379,7 +379,7 @@ class Products extends AbstractRoute {
|
|||
'sanitize_callback' => 'wp_parse_id_list',
|
||||
),
|
||||
'slug' => array(
|
||||
'description' => __( 'List of attribute slug(s). If a term ID is provided, this will be ignored.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of attribute slug(s). If a term ID is provided, this will be ignored.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'items' => [
|
||||
'type' => 'string',
|
||||
|
@ -387,7 +387,7 @@ class Products extends AbstractRoute {
|
|||
'sanitize_callback' => 'wp_parse_slug_list',
|
||||
),
|
||||
'operator' => array(
|
||||
'description' => __( 'Operator to compare product attribute terms.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Operator to compare product attribute terms.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'enum' => [ 'in', 'not_in', 'and' ],
|
||||
),
|
||||
|
@ -397,7 +397,7 @@ class Products extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['attribute_relation'] = array(
|
||||
'description' => __( 'The logical relationship between attributes when filtering across multiple at once.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The logical relationship between attributes when filtering across multiple at once.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'enum' => [ 'in', 'and' ],
|
||||
'default' => 'and',
|
||||
|
@ -406,7 +406,7 @@ class Products extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['catalog_visibility'] = array(
|
||||
'description' => __( 'Determines if hidden or visible catalog products are shown.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Determines if hidden or visible catalog products are shown.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'enum' => array( 'any', 'visible', 'catalog', 'search', 'hidden' ),
|
||||
'sanitize_callback' => 'sanitize_key',
|
||||
|
@ -414,7 +414,7 @@ class Products extends AbstractRoute {
|
|||
);
|
||||
|
||||
$params['rating'] = array(
|
||||
'description' => __( 'Limit result set to products with a certain average rating.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Limit result set to products with a certain average rating.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'integer',
|
||||
|
|
|
@ -39,7 +39,7 @@ class ProductsById extends AbstractRoute {
|
|||
return [
|
||||
'args' => array(
|
||||
'id' => array(
|
||||
'description' => __( 'Unique identifier for the resource.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
),
|
||||
),
|
||||
|
@ -70,7 +70,7 @@ class ProductsById extends AbstractRoute {
|
|||
$object = wc_get_product( (int) $request['id'] );
|
||||
|
||||
if ( ! $object || 0 === $object->get_id() ) {
|
||||
throw new RouteException( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woo-gutenberg-products-block' ), 404 );
|
||||
throw new RouteException( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
return rest_ensure_response( $this->schema->get_item_response( $object ) );
|
||||
|
|
|
@ -39,7 +39,7 @@ class ProductsBySlug extends AbstractRoute {
|
|||
return [
|
||||
'args' => array(
|
||||
'slug' => array(
|
||||
'description' => __( 'Slug of the resource.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Slug of the resource.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
),
|
||||
),
|
||||
|
@ -75,7 +75,7 @@ class ProductsBySlug extends AbstractRoute {
|
|||
}
|
||||
|
||||
if ( ! $object || 0 === $object->get_id() ) {
|
||||
throw new RouteException( 'woocommerce_rest_product_invalid_slug', __( 'Invalid product slug.', 'woo-gutenberg-products-block' ), 404 );
|
||||
throw new RouteException( 'woocommerce_rest_product_invalid_slug', __( 'Invalid product slug.', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
return rest_ensure_response( $this->schema->get_item_response( $object ) );
|
||||
|
|
|
@ -332,7 +332,7 @@ final class ExtendSchema {
|
|||
if ( ARRAY_N === $schema_type ) {
|
||||
return [
|
||||
/* translators: %s: extension namespace */
|
||||
'description' => sprintf( __( 'Extension data registered by %s', 'woo-gutenberg-products-block' ), $namespace ),
|
||||
'description' => sprintf( __( 'Extension data registered by %s', 'woocommerce' ), $namespace ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'items' => $schema,
|
||||
|
@ -340,7 +340,7 @@ final class ExtendSchema {
|
|||
}
|
||||
return [
|
||||
/* translators: %s: extension namespace */
|
||||
'description' => sprintf( __( 'Extension data registered by %s', 'woo-gutenberg-products-block' ), $namespace ),
|
||||
'description' => sprintf( __( 'Extension data registered by %s', 'woocommerce' ), $namespace ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'properties' => $schema,
|
||||
|
|
|
@ -18,61 +18,61 @@ abstract class AbstractAddressSchema extends AbstractSchema {
|
|||
public function get_properties() {
|
||||
return [
|
||||
'first_name' => [
|
||||
'description' => __( 'First name', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'First name', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'required' => true,
|
||||
],
|
||||
'last_name' => [
|
||||
'description' => __( 'Last name', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Last name', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'required' => true,
|
||||
],
|
||||
'company' => [
|
||||
'description' => __( 'Company', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Company', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'required' => true,
|
||||
],
|
||||
'address_1' => [
|
||||
'description' => __( 'Address', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Address', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'required' => true,
|
||||
],
|
||||
'address_2' => [
|
||||
'description' => __( 'Apartment, suite, etc.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Apartment, suite, etc.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'required' => true,
|
||||
],
|
||||
'city' => [
|
||||
'description' => __( 'City', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'City', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'required' => true,
|
||||
],
|
||||
'state' => [
|
||||
'description' => __( 'State/County code, or name of the state, county, province, or district.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'State/County code, or name of the state, county, province, or district.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'required' => true,
|
||||
],
|
||||
'postcode' => [
|
||||
'description' => __( 'Postal code', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Postal code', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'required' => true,
|
||||
],
|
||||
'country' => [
|
||||
'description' => __( 'Country/Region code in ISO 3166-1 alpha-2 format.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Country/Region code in ISO 3166-1 alpha-2 format.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'required' => true,
|
||||
],
|
||||
'phone' => [
|
||||
'description' => __( 'Phone', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Phone', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'required' => true,
|
||||
|
@ -125,7 +125,7 @@ abstract class AbstractAddressSchema extends AbstractSchema {
|
|||
'invalid_country',
|
||||
sprintf(
|
||||
/* translators: %s valid country codes */
|
||||
__( 'Invalid country code provided. Must be one of: %s', 'woo-gutenberg-products-block' ),
|
||||
__( 'Invalid country code provided. Must be one of: %s', 'woocommerce' ),
|
||||
implode( ', ', array_keys( wc()->countries->get_countries() ) )
|
||||
)
|
||||
);
|
||||
|
@ -137,7 +137,7 @@ abstract class AbstractAddressSchema extends AbstractSchema {
|
|||
'invalid_state',
|
||||
sprintf(
|
||||
/* translators: %1$s given state, %2$s valid states */
|
||||
__( 'The provided state (%1$s) is not valid. Must be one of: %2$s', 'woo-gutenberg-products-block' ),
|
||||
__( 'The provided state (%1$s) is not valid. Must be one of: %2$s', 'woocommerce' ),
|
||||
esc_html( $address['state'] ),
|
||||
implode( ', ', array_keys( $validation_util->get_states_for_country( $address['country'] ) ) )
|
||||
)
|
||||
|
@ -147,14 +147,14 @@ abstract class AbstractAddressSchema extends AbstractSchema {
|
|||
if ( ! empty( $address['postcode'] ) && ! \WC_Validation::is_postcode( $address['postcode'], $address['country'] ) ) {
|
||||
$errors->add(
|
||||
'invalid_postcode',
|
||||
__( 'The provided postcode / ZIP is not valid', 'woo-gutenberg-products-block' )
|
||||
__( 'The provided postcode / ZIP is not valid', 'woocommerce' )
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! empty( $address['phone'] ) && ! \WC_Validation::is_phone( $address['phone'] ) ) {
|
||||
$errors->add(
|
||||
'invalid_phone',
|
||||
__( 'The provided phone number is not valid', 'woo-gutenberg-products-block' )
|
||||
__( 'The provided phone number is not valid', 'woocommerce' )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -319,43 +319,43 @@ abstract class AbstractSchema {
|
|||
protected function get_store_currency_properties() {
|
||||
return [
|
||||
'currency_code' => [
|
||||
'description' => __( 'Currency code (in ISO format) for returned prices.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Currency code (in ISO format) for returned prices.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'currency_symbol' => [
|
||||
'description' => __( 'Currency symbol for the currency which can be used to format returned prices.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Currency symbol for the currency which can be used to format returned prices.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'currency_minor_unit' => [
|
||||
'description' => __( 'Currency minor unit (number of digits after the decimal separator) for returned prices.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Currency minor unit (number of digits after the decimal separator) for returned prices.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'currency_decimal_separator' => array(
|
||||
'description' => __( 'Decimal separator for the currency which can be used to format returned prices.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Decimal separator for the currency which can be used to format returned prices.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'currency_thousand_separator' => array(
|
||||
'description' => __( 'Thousand separator for the currency which can be used to format returned prices.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Thousand separator for the currency which can be used to format returned prices.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'currency_prefix' => array(
|
||||
'description' => __( 'Price prefix for the currency which can be used to format returned prices.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Price prefix for the currency which can be used to format returned prices.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'currency_suffix' => array(
|
||||
'description' => __( 'Price prefix for the currency which can be used to format returned prices.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Price prefix for the currency which can be used to format returned prices.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
|
|
|
@ -35,7 +35,7 @@ class BillingAddressSchema extends AbstractAddressSchema {
|
|||
$properties,
|
||||
[
|
||||
'email' => [
|
||||
'description' => __( 'Email', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Email', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'required' => true,
|
||||
|
@ -74,7 +74,7 @@ class BillingAddressSchema extends AbstractAddressSchema {
|
|||
if ( ! empty( $address['email'] ) && ! is_email( $address['email'] ) ) {
|
||||
$errors->add(
|
||||
'invalid_email',
|
||||
__( 'The provided email address is not valid', 'woo-gutenberg-products-block' )
|
||||
__( 'The provided email address is not valid', 'woocommerce' )
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ class BillingAddressSchema extends AbstractAddressSchema {
|
|||
'invalid_object_type',
|
||||
sprintf(
|
||||
/* translators: Placeholders are class and method names */
|
||||
__( '%1$s requires an instance of %2$s or %3$s for the address', 'woo-gutenberg-products-block' ),
|
||||
__( '%1$s requires an instance of %2$s or %3$s for the address', 'woocommerce' ),
|
||||
'BillingAddressSchema::get_item_response',
|
||||
'WC_Customer',
|
||||
'WC_Order'
|
||||
|
|
|
@ -29,7 +29,7 @@ class CartCouponSchema extends AbstractSchema {
|
|||
public function get_properties() {
|
||||
return [
|
||||
'code' => [
|
||||
'description' => __( 'The coupon\'s unique code.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The coupon\'s unique code.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'arg_options' => [
|
||||
|
@ -38,7 +38,7 @@ class CartCouponSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'discount_type' => [
|
||||
'description' => __( 'The discount type for the coupon (e.g. percentage or fixed amount)', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The discount type for the coupon (e.g. percentage or fixed amount)', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'arg_options' => [
|
||||
|
@ -46,7 +46,7 @@ class CartCouponSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'totals' => [
|
||||
'description' => __( 'Total amounts provided using the smallest unit of the currency.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total amounts provided using the smallest unit of the currency.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -54,13 +54,13 @@ class CartCouponSchema extends AbstractSchema {
|
|||
$this->get_store_currency_properties(),
|
||||
[
|
||||
'total_discount' => [
|
||||
'description' => __( 'Total discount applied by this coupon.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total discount applied by this coupon.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_discount_tax' => [
|
||||
'description' => __( 'Total tax removed due to discount applied by this coupon.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total tax removed due to discount applied by this coupon.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
|
|
@ -27,19 +27,19 @@ class CartFeeSchema extends AbstractSchema {
|
|||
public function get_properties() {
|
||||
return [
|
||||
'id' => [
|
||||
'description' => __( 'Unique identifier for the fee within the cart.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the fee within the cart.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'name' => [
|
||||
'description' => __( 'Fee name.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Fee name.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'totals' => [
|
||||
'description' => __( 'Fee total amounts provided using the smallest unit of the currency.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Fee total amounts provided using the smallest unit of the currency.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -47,13 +47,13 @@ class CartFeeSchema extends AbstractSchema {
|
|||
$this->get_store_currency_properties(),
|
||||
[
|
||||
'total' => [
|
||||
'description' => __( 'Total amount for this fee.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total amount for this fee.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_tax' => [
|
||||
'description' => __( 'Total tax amount for this fee.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total tax amount for this fee.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
|
|
@ -106,7 +106,7 @@ class CartSchema extends AbstractSchema {
|
|||
public function get_properties() {
|
||||
return [
|
||||
'coupons' => [
|
||||
'description' => __( 'List of applied cart coupons.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of applied cart coupons.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -116,7 +116,7 @@ class CartSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'shipping_rates' => [
|
||||
'description' => __( 'List of available shipping rates for the cart.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of available shipping rates for the cart.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -126,21 +126,21 @@ class CartSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'shipping_address' => [
|
||||
'description' => __( 'Current set shipping address for the customer.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Current set shipping address for the customer.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
'properties' => $this->force_schema_readonly( $this->shipping_address_schema->get_properties() ),
|
||||
],
|
||||
'billing_address' => [
|
||||
'description' => __( 'Current set billing address for the customer.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Current set billing address for the customer.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
'properties' => $this->force_schema_readonly( $this->billing_address_schema->get_properties() ),
|
||||
],
|
||||
'items' => [
|
||||
'description' => __( 'List of cart items.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of cart items.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -150,19 +150,19 @@ class CartSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'items_count' => [
|
||||
'description' => __( 'Number of items in the cart.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Number of items in the cart.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'items_weight' => [
|
||||
'description' => __( 'Total weight (in grams) of all products in the cart.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total weight (in grams) of all products in the cart.', 'woocommerce' ),
|
||||
'type' => 'number',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'cross_sells' => [
|
||||
'description' => __( 'List of cross-sells items related to cart items.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of cross-sells items related to cart items.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -172,25 +172,25 @@ class CartSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'needs_payment' => [
|
||||
'description' => __( 'True if the cart needs payment. False for carts with only free products and no shipping costs.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'True if the cart needs payment. False for carts with only free products and no shipping costs.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'needs_shipping' => [
|
||||
'description' => __( 'True if the cart needs shipping. False for carts with only digital goods or stores with no shipping methods set-up.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'True if the cart needs shipping. False for carts with only digital goods or stores with no shipping methods set-up.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'has_calculated_shipping' => [
|
||||
'description' => __( 'True if the cart meets the criteria for showing shipping costs, and rates have been calculated and included in the totals.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'True if the cart meets the criteria for showing shipping costs, and rates have been calculated and included in the totals.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'fees' => [
|
||||
'description' => __( 'List of cart fees.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of cart fees.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -200,7 +200,7 @@ class CartSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'totals' => [
|
||||
'description' => __( 'Cart total amounts provided using the smallest unit of the currency.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Cart total amounts provided using the smallest unit of the currency.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -208,67 +208,67 @@ class CartSchema extends AbstractSchema {
|
|||
$this->get_store_currency_properties(),
|
||||
[
|
||||
'total_items' => [
|
||||
'description' => __( 'Total price of items in the cart.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total price of items in the cart.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_items_tax' => [
|
||||
'description' => __( 'Total tax on items in the cart.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total tax on items in the cart.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_fees' => [
|
||||
'description' => __( 'Total price of any applied fees.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total price of any applied fees.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_fees_tax' => [
|
||||
'description' => __( 'Total tax on fees.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total tax on fees.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_discount' => [
|
||||
'description' => __( 'Total discount from applied coupons.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total discount from applied coupons.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_discount_tax' => [
|
||||
'description' => __( 'Total tax removed due to discount from applied coupons.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total tax removed due to discount from applied coupons.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_shipping' => [
|
||||
'description' => __( 'Total price of shipping. If shipping has not been calculated, a null response will be sent.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total price of shipping. If shipping has not been calculated, a null response will be sent.', 'woocommerce' ),
|
||||
'type' => [ 'string', 'null' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_shipping_tax' => [
|
||||
'description' => __( 'Total tax on shipping. If shipping has not been calculated, a null response will be sent.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total tax on shipping. If shipping has not been calculated, a null response will be sent.', 'woocommerce' ),
|
||||
'type' => [ 'string', 'null' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_price' => [
|
||||
'description' => __( 'Total price the customer will pay.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total price the customer will pay.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_tax' => [
|
||||
'description' => __( 'Total tax applied to items and shipping.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total tax applied to items and shipping.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'tax_lines' => [
|
||||
'description' => __( 'Lines of taxes applied to items and shipping.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Lines of taxes applied to items and shipping.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -276,19 +276,19 @@ class CartSchema extends AbstractSchema {
|
|||
'type' => 'object',
|
||||
'properties' => [
|
||||
'name' => [
|
||||
'description' => __( 'The name of the tax.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The name of the tax.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'price' => [
|
||||
'description' => __( 'The amount of tax charged.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The amount of tax charged.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'rate' => [
|
||||
'description' => __( 'The rate at which tax is applied.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The rate at which tax is applied.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -300,7 +300,7 @@ class CartSchema extends AbstractSchema {
|
|||
),
|
||||
],
|
||||
'errors' => [
|
||||
'description' => __( 'List of cart item errors, for example, items in the cart which are out of stock.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of cart item errors, for example, items in the cart which are out of stock.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -310,13 +310,13 @@ class CartSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'payment_methods' => [
|
||||
'description' => __( 'List of available payment method IDs that can be used to process the order.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of available payment method IDs that can be used to process the order.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'payment_requirements' => [
|
||||
'description' => __( 'List of required payment gateway features to process the order.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of required payment gateway features to process the order.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
|
|
@ -29,55 +29,55 @@ class CartShippingRateSchema extends AbstractSchema {
|
|||
public function get_properties() {
|
||||
return [
|
||||
'package_id' => [
|
||||
'description' => __( 'The ID of the package the shipping rates belong to.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The ID of the package the shipping rates belong to.', 'woocommerce' ),
|
||||
'type' => [ 'integer', 'string' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'name' => [
|
||||
'description' => __( 'Name of the package.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Name of the package.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'destination' => [
|
||||
'description' => __( 'Shipping destination address.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Shipping destination address.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
'properties' => [
|
||||
'address_1' => [
|
||||
'description' => __( 'First line of the address being shipped to.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'First line of the address being shipped to.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'address_2' => [
|
||||
'description' => __( 'Second line of the address being shipped to.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Second line of the address being shipped to.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'city' => [
|
||||
'description' => __( 'City of the address being shipped to.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'City of the address being shipped to.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'state' => [
|
||||
'description' => __( 'ISO code, or name, for the state, province, or district of the address being shipped to.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'ISO code, or name, for the state, province, or district of the address being shipped to.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'postcode' => [
|
||||
'description' => __( 'Zip or Postcode of the address being shipped to.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Zip or Postcode of the address being shipped to.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'country' => [
|
||||
'description' => __( 'ISO code for the country of the address being shipped to.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'ISO code for the country of the address being shipped to.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -85,7 +85,7 @@ class CartShippingRateSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'items' => [
|
||||
'description' => __( 'List of cart items the returned shipping rates apply to.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of cart items the returned shipping rates apply to.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -93,19 +93,19 @@ class CartShippingRateSchema extends AbstractSchema {
|
|||
'type' => 'object',
|
||||
'properties' => [
|
||||
'key' => [
|
||||
'description' => __( 'Unique identifier for the item within the cart.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the item within the cart.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'name' => [
|
||||
'description' => __( 'Name of the item.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Name of the item.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'quantity' => [
|
||||
'description' => __( 'Quantity of the item in the current package.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Quantity of the item in the current package.', 'woocommerce' ),
|
||||
'type' => 'number',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -114,7 +114,7 @@ class CartShippingRateSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'shipping_rates' => [
|
||||
'description' => __( 'List of shipping rates.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of shipping rates.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -135,68 +135,68 @@ class CartShippingRateSchema extends AbstractSchema {
|
|||
return array_merge(
|
||||
[
|
||||
'rate_id' => [
|
||||
'description' => __( 'ID of the shipping rate.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'ID of the shipping rate.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'name' => [
|
||||
'description' => __( 'Name of the shipping rate, e.g. Express shipping.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Name of the shipping rate, e.g. Express shipping.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'description' => [
|
||||
'description' => __( 'Description of the shipping rate, e.g. Dispatched via USPS.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Description of the shipping rate, e.g. Dispatched via USPS.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'delivery_time' => [
|
||||
'description' => __( 'Delivery time estimate text, e.g. 3-5 business days.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Delivery time estimate text, e.g. 3-5 business days.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'price' => [
|
||||
'description' => __( 'Price of this shipping rate using the smallest unit of the currency.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Price of this shipping rate using the smallest unit of the currency.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'taxes' => [
|
||||
'description' => __( 'Taxes applied to this shipping rate using the smallest unit of the currency.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Taxes applied to this shipping rate using the smallest unit of the currency.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'method_id' => [
|
||||
'description' => __( 'ID of the shipping method that provided the rate.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'ID of the shipping method that provided the rate.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'instance_id' => [
|
||||
'description' => __( 'Instance ID of the shipping method that provided the rate.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Instance ID of the shipping method that provided the rate.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'meta_data' => [
|
||||
'description' => __( 'Meta data attached to the shipping rate.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Meta data attached to the shipping rate.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'items' => [
|
||||
'type' => 'object',
|
||||
'properties' => [
|
||||
'key' => [
|
||||
'description' => __( 'Meta key.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Meta key.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'value' => [
|
||||
'description' => __( 'Meta value.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Meta value.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -205,7 +205,7 @@ class CartShippingRateSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'selected' => [
|
||||
'description' => __( 'True if this is the rate currently selected by the customer for the cart.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'True if this is the rate currently selected by the customer for the cart.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
|
|
@ -66,42 +66,42 @@ class CheckoutSchema extends AbstractSchema {
|
|||
public function get_properties() {
|
||||
return [
|
||||
'order_id' => [
|
||||
'description' => __( 'The order ID to process during checkout.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The order ID to process during checkout.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'status' => [
|
||||
'description' => __( 'Order status. Payment providers will update this value after payment.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Order status. Payment providers will update this value after payment.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'order_key' => [
|
||||
'description' => __( 'Order key used to check validity or protect access to certain order data.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Order key used to check validity or protect access to certain order data.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'order_number' => [
|
||||
'description' => __( 'Order number used for display.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Order number used for display.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'customer_note' => [
|
||||
'description' => __( 'Note added to the order by the customer during checkout.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Note added to the order by the customer during checkout.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
'customer_id' => [
|
||||
'description' => __( 'Customer ID if registered. Will return 0 for guests.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Customer ID if registered. Will return 0 for guests.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'billing_address' => [
|
||||
'description' => __( 'Billing address.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Billing address.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'properties' => $this->billing_address_schema->get_properties(),
|
||||
|
@ -112,7 +112,7 @@ class CheckoutSchema extends AbstractSchema {
|
|||
'required' => true,
|
||||
],
|
||||
'shipping_address' => [
|
||||
'description' => __( 'Shipping address.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Shipping address.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'properties' => $this->shipping_address_schema->get_properties(),
|
||||
|
@ -122,7 +122,7 @@ class CheckoutSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'payment_method' => [
|
||||
'description' => __( 'The ID of the payment method being used to process the payment.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The ID of the payment method being used to process the payment.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
// Validation may be based on cart contents which is not available here; this returns all enabled
|
||||
|
@ -130,23 +130,23 @@ class CheckoutSchema extends AbstractSchema {
|
|||
'enum' => array_values( WC()->payment_gateways->get_payment_gateway_ids() ),
|
||||
],
|
||||
'create_account' => [
|
||||
'description' => __( 'Whether to create a new user account as part of order processing.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Whether to create a new user account as part of order processing.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
'payment_result' => [
|
||||
'description' => __( 'Result of payment processing, or false if not yet processed.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Result of payment processing, or false if not yet processed.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
'properties' => [
|
||||
'payment_status' => [
|
||||
'description' => __( 'Status of the payment returned by the gateway. One of success, pending, failure, error.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Status of the payment returned by the gateway. One of success, pending, failure, error.', 'woocommerce' ),
|
||||
'readonly' => true,
|
||||
'type' => 'string',
|
||||
],
|
||||
'payment_details' => [
|
||||
'description' => __( 'An array of data being returned from the payment gateway.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'An array of data being returned from the payment gateway.', 'woocommerce' ),
|
||||
'readonly' => true,
|
||||
'type' => 'array',
|
||||
'items' => [
|
||||
|
@ -162,7 +162,7 @@ class CheckoutSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'redirect_url' => [
|
||||
'description' => __( 'A URL to redirect the customer after checkout. This could be, for example, a link to the payment processors website.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'A URL to redirect the customer after checkout. This could be, for example, a link to the payment processors website.', 'woocommerce' ),
|
||||
'readonly' => true,
|
||||
'type' => 'string',
|
||||
],
|
||||
|
|
|
@ -27,13 +27,13 @@ class ErrorSchema extends AbstractSchema {
|
|||
public function get_properties() {
|
||||
return [
|
||||
'code' => [
|
||||
'description' => __( 'Error code', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Error code', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'message' => [
|
||||
'description' => __( 'Error message', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Error message', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
|
|
@ -27,39 +27,39 @@ class ImageAttachmentSchema extends AbstractSchema {
|
|||
public function get_properties() {
|
||||
return [
|
||||
'id' => [
|
||||
'description' => __( 'Image ID.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Image ID.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
'src' => [
|
||||
'description' => __( 'Full size image URL.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Full size image URL.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'format' => 'uri',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
'thumbnail' => [
|
||||
'description' => __( 'Thumbnail URL.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Thumbnail URL.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'format' => 'uri',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
'srcset' => [
|
||||
'description' => __( 'Thumbnail srcset for responsive images.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Thumbnail srcset for responsive images.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
'sizes' => [
|
||||
'description' => __( 'Thumbnail sizes for responsive images.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Thumbnail sizes for responsive images.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
'name' => [
|
||||
'description' => __( 'Image name.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Image name.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
'alt' => [
|
||||
'description' => __( 'Image alternative text.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Image alternative text.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
|
|
|
@ -14,56 +14,56 @@ abstract class ItemSchema extends ProductSchema {
|
|||
public function get_properties() {
|
||||
return [
|
||||
'key' => [
|
||||
'description' => __( 'Unique identifier for the item.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the item.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'type' => [
|
||||
'description' => __( 'The item type.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The item type.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'id' => [
|
||||
'description' => __( 'The item product or variation ID.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The item product or variation ID.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'quantity' => [
|
||||
'description' => __( 'Quantity of this item.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Quantity of this item.', 'woocommerce' ),
|
||||
'type' => 'number',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'quantity_limits' => [
|
||||
'description' => __( 'How the quantity of this item should be controlled, for example, any limits in place.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'How the quantity of this item should be controlled, for example, any limits in place.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
'properties' => [
|
||||
'minimum' => [
|
||||
'description' => __( 'The minimum quantity allowed for this line item.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The minimum quantity allowed for this line item.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'maximum' => [
|
||||
'description' => __( 'The maximum quantity allowed for this line item.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The maximum quantity allowed for this line item.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'multiple_of' => [
|
||||
'description' => __( 'The amount that quantities increment by. Quantity must be an multiple of this value.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The amount that quantities increment by. Quantity must be an multiple of this value.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
'default' => 1,
|
||||
],
|
||||
'editable' => [
|
||||
'description' => __( 'If the quantity is editable or fixed.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'If the quantity is editable or fixed.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -72,62 +72,62 @@ abstract class ItemSchema extends ProductSchema {
|
|||
],
|
||||
],
|
||||
'name' => [
|
||||
'description' => __( 'Product name.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Product name.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'short_description' => [
|
||||
'description' => __( 'Product short description in HTML format.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Product short description in HTML format.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'description' => [
|
||||
'description' => __( 'Product full description in HTML format.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Product full description in HTML format.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'sku' => [
|
||||
'description' => __( 'Stock keeping unit, if applicable.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Stock keeping unit, if applicable.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'low_stock_remaining' => [
|
||||
'description' => __( 'Quantity left in stock if stock is low, or null if not applicable.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Quantity left in stock if stock is low, or null if not applicable.', 'woocommerce' ),
|
||||
'type' => [ 'integer', 'null' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'backorders_allowed' => [
|
||||
'description' => __( 'True if backorders are allowed past stock availability.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'True if backorders are allowed past stock availability.', 'woocommerce' ),
|
||||
'type' => [ 'boolean' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'show_backorder_badge' => [
|
||||
'description' => __( 'True if the product is on backorder.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'True if the product is on backorder.', 'woocommerce' ),
|
||||
'type' => [ 'boolean' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'sold_individually' => [
|
||||
'description' => __( 'If true, only one item of this product is allowed for purchase in a single order.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'If true, only one item of this product is allowed for purchase in a single order.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'permalink' => [
|
||||
'description' => __( 'Product URL.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Product URL.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'format' => 'uri',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'images' => [
|
||||
'description' => __( 'List of images.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of images.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -137,7 +137,7 @@ abstract class ItemSchema extends ProductSchema {
|
|||
],
|
||||
],
|
||||
'variation' => [
|
||||
'description' => __( 'Chosen attributes (for variations).', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Chosen attributes (for variations).', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -145,13 +145,13 @@ abstract class ItemSchema extends ProductSchema {
|
|||
'type' => 'object',
|
||||
'properties' => [
|
||||
'attribute' => [
|
||||
'description' => __( 'Variation attribute name.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Variation attribute name.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'value' => [
|
||||
'description' => __( 'Variation attribute value.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Variation attribute value.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -160,7 +160,7 @@ abstract class ItemSchema extends ProductSchema {
|
|||
],
|
||||
],
|
||||
'item_data' => [
|
||||
'description' => __( 'Metadata related to the item', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Metadata related to the item', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -168,19 +168,19 @@ abstract class ItemSchema extends ProductSchema {
|
|||
'type' => 'object',
|
||||
'properties' => [
|
||||
'name' => [
|
||||
'description' => __( 'Name of the metadata.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Name of the metadata.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'value' => [
|
||||
'description' => __( 'Value of the metadata.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Value of the metadata.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'display' => [
|
||||
'description' => __( 'Optionally, how the metadata value should be displayed to the user.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Optionally, how the metadata value should be displayed to the user.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -189,7 +189,7 @@ abstract class ItemSchema extends ProductSchema {
|
|||
],
|
||||
],
|
||||
'prices' => [
|
||||
'description' => __( 'Price data for the product in the current line item, including or excluding taxes based on the "display prices during cart and checkout" setting. Provided using the smallest unit of the currency.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Price data for the product in the current line item, including or excluding taxes based on the "display prices during cart and checkout" setting. Provided using the smallest unit of the currency.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -197,37 +197,37 @@ abstract class ItemSchema extends ProductSchema {
|
|||
$this->get_store_currency_properties(),
|
||||
[
|
||||
'price' => [
|
||||
'description' => __( 'Current product price.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Current product price.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'regular_price' => [
|
||||
'description' => __( 'Regular product price.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Regular product price.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'sale_price' => [
|
||||
'description' => __( 'Sale product price, if applicable.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Sale product price, if applicable.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'price_range' => [
|
||||
'description' => __( 'Price range, if applicable.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Price range, if applicable.', 'woocommerce' ),
|
||||
'type' => [ 'object', 'null' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
'properties' => [
|
||||
'min_amount' => [
|
||||
'description' => __( 'Price amount.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Price amount.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'max_amount' => [
|
||||
'description' => __( 'Price amount.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Price amount.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -235,31 +235,31 @@ abstract class ItemSchema extends ProductSchema {
|
|||
],
|
||||
],
|
||||
'raw_prices' => [
|
||||
'description' => __( 'Raw unrounded product prices used in calculations. Provided using a higher unit of precision than the currency.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Raw unrounded product prices used in calculations. Provided using a higher unit of precision than the currency.', 'woocommerce' ),
|
||||
'type' => [ 'object', 'null' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
'properties' => [
|
||||
'precision' => [
|
||||
'description' => __( 'Decimal precision of the returned prices.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Decimal precision of the returned prices.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'price' => [
|
||||
'description' => __( 'Current product price.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Current product price.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'regular_price' => [
|
||||
'description' => __( 'Regular product price.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Regular product price.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'sale_price' => [
|
||||
'description' => __( 'Sale product price, if applicable.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Sale product price, if applicable.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -270,7 +270,7 @@ abstract class ItemSchema extends ProductSchema {
|
|||
),
|
||||
],
|
||||
'totals' => [
|
||||
'description' => __( 'Item total amounts provided using the smallest unit of the currency.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Item total amounts provided using the smallest unit of the currency.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -278,25 +278,25 @@ abstract class ItemSchema extends ProductSchema {
|
|||
$this->get_store_currency_properties(),
|
||||
[
|
||||
'line_subtotal' => [
|
||||
'description' => __( 'Line subtotal (the price of the product before coupon discounts have been applied).', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Line subtotal (the price of the product before coupon discounts have been applied).', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'line_subtotal_tax' => [
|
||||
'description' => __( 'Line subtotal tax.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Line subtotal tax.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'line_total' => [
|
||||
'description' => __( 'Line total (the price of the product after coupon discounts have been applied).', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Line total (the price of the product after coupon discounts have been applied).', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'line_total_tax' => [
|
||||
'description' => __( 'Line total tax.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Line total tax.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -305,7 +305,7 @@ abstract class ItemSchema extends ProductSchema {
|
|||
),
|
||||
],
|
||||
'catalog_visibility' => [
|
||||
'description' => __( 'Whether the product is visible in the catalog', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Whether the product is visible in the catalog', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
|
|
@ -27,19 +27,19 @@ class OrderCouponSchema extends AbstractSchema {
|
|||
public function get_properties() {
|
||||
return [
|
||||
'code' => [
|
||||
'description' => __( 'The coupons unique code.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The coupons unique code.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'discount_type' => [
|
||||
'description' => __( 'The discount type for the coupon (e.g. percentage or fixed amount)', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The discount type for the coupon (e.g. percentage or fixed amount)', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'totals' => [
|
||||
'description' => __( 'Total amounts provided using the smallest unit of the currency.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total amounts provided using the smallest unit of the currency.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -47,13 +47,13 @@ class OrderCouponSchema extends AbstractSchema {
|
|||
$this->get_store_currency_properties(),
|
||||
[
|
||||
'total_discount' => [
|
||||
'description' => __( 'Total discount applied by this coupon.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total discount applied by this coupon.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_discount_tax' => [
|
||||
'description' => __( 'Total tax removed due to discount applied by this coupon.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total tax removed due to discount applied by this coupon.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
|
|
@ -27,19 +27,19 @@ class OrderFeeSchema extends AbstractSchema {
|
|||
public function get_properties() {
|
||||
return [
|
||||
'id' => [
|
||||
'description' => __( 'Unique identifier for the fee within the cart', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the fee within the cart', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'name' => [
|
||||
'description' => __( 'Fee name', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Fee name', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'totals' => [
|
||||
'description' => __( 'Fee total amounts provided using the smallest unit of the currency.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Fee total amounts provided using the smallest unit of the currency.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -47,13 +47,13 @@ class OrderFeeSchema extends AbstractSchema {
|
|||
$this->get_store_currency_properties(),
|
||||
[
|
||||
'total' => [
|
||||
'description' => __( 'Total amount for this fee.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total amount for this fee.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_tax' => [
|
||||
'description' => __( 'Total tax amount for this fee.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total tax amount for this fee.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
|
|
@ -112,13 +112,13 @@ class OrderSchema extends AbstractSchema {
|
|||
public function get_properties() {
|
||||
return [
|
||||
'id' => [
|
||||
'description' => __( 'The order ID.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The order ID.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'items' => [
|
||||
'description' => __( 'Line items data.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Line items data.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'items' => [
|
||||
|
@ -127,7 +127,7 @@ class OrderSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'totals' => [
|
||||
'description' => __( 'Order totals.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Order totals.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -135,79 +135,79 @@ class OrderSchema extends AbstractSchema {
|
|||
$this->get_store_currency_properties(),
|
||||
[
|
||||
'subtotal' => [
|
||||
'description' => __( 'Subtotal of the order.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Subtotal of the order.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_discount' => [
|
||||
'description' => __( 'Total discount from applied coupons.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total discount from applied coupons.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_shipping' => [
|
||||
'description' => __( 'Total price of shipping.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total price of shipping.', 'woocommerce' ),
|
||||
'type' => [ 'string', 'null' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_fees' => [
|
||||
'description' => __( 'Total price of any applied fees.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total price of any applied fees.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_tax' => [
|
||||
'description' => __( 'Total tax applied to the order.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total tax applied to the order.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_refund' => [
|
||||
'description' => __( 'Total refund applied to the order.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total refund applied to the order.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_price' => [
|
||||
'description' => __( 'Total price the customer will pay.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total price the customer will pay.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_items' => [
|
||||
'description' => __( 'Total price of items in the order.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total price of items in the order.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_items_tax' => [
|
||||
'description' => __( 'Total tax on items in the order.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total tax on items in the order.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_fees_tax' => [
|
||||
'description' => __( 'Total tax on fees.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total tax on fees.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_discount_tax' => [
|
||||
'description' => __( 'Total tax removed due to discount from applied coupons.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total tax removed due to discount from applied coupons.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'total_shipping_tax' => [
|
||||
'description' => __( 'Total tax on shipping. If shipping has not been calculated, a null response will be sent.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Total tax on shipping. If shipping has not been calculated, a null response will be sent.', 'woocommerce' ),
|
||||
'type' => [ 'string', 'null' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'tax_lines' => [
|
||||
'description' => __( 'Lines of taxes applied to items and shipping.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Lines of taxes applied to items and shipping.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -215,19 +215,19 @@ class OrderSchema extends AbstractSchema {
|
|||
'type' => 'object',
|
||||
'properties' => [
|
||||
'name' => [
|
||||
'description' => __( 'The name of the tax.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The name of the tax.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'price' => [
|
||||
'description' => __( 'The amount of tax charged.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The amount of tax charged.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'rate' => [
|
||||
'description' => __( 'The rate at which tax is applied.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The rate at which tax is applied.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -239,7 +239,7 @@ class OrderSchema extends AbstractSchema {
|
|||
),
|
||||
],
|
||||
'coupons' => [
|
||||
'description' => __( 'List of applied cart coupons.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of applied cart coupons.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -249,33 +249,33 @@ class OrderSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'shipping_address' => [
|
||||
'description' => __( 'Current set shipping address for the customer.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Current set shipping address for the customer.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
'properties' => $this->force_schema_readonly( $this->shipping_address_schema->get_properties() ),
|
||||
],
|
||||
'billing_address' => [
|
||||
'description' => __( 'Current set billing address for the customer.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Current set billing address for the customer.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
'properties' => $this->force_schema_readonly( $this->billing_address_schema->get_properties() ),
|
||||
],
|
||||
'needs_payment' => [
|
||||
'description' => __( 'True if the cart needs payment. False for carts with only free products and no shipping costs.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'True if the cart needs payment. False for carts with only free products and no shipping costs.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'needs_shipping' => [
|
||||
'description' => __( 'True if the cart needs shipping. False for carts with only digital goods or stores with no shipping methods set-up.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'True if the cart needs shipping. False for carts with only digital goods or stores with no shipping methods set-up.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'errors' => [
|
||||
'description' => __( 'List of cart item errors, for example, items in the cart which are out of stock.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of cart item errors, for example, items in the cart which are out of stock.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -285,13 +285,13 @@ class OrderSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'payment_requirements' => [
|
||||
'description' => __( 'List of required payment gateway features to process the order.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of required payment gateway features to process the order.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'status' => [
|
||||
'description' => __( 'Status of the order.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Status of the order.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
|
|
@ -27,43 +27,43 @@ class ProductAttributeSchema extends AbstractSchema {
|
|||
public function get_properties() {
|
||||
return [
|
||||
'id' => array(
|
||||
'description' => __( 'Unique identifier for the resource.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'name' => array(
|
||||
'description' => __( 'Attribute name.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Attribute name.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'taxonomy' => array(
|
||||
'description' => __( 'The attribute taxonomy name.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The attribute taxonomy name.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'type' => array(
|
||||
'description' => __( 'Attribute type.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Attribute type.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'order' => array(
|
||||
'description' => __( 'How terms in this attribute are sorted by default.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'How terms in this attribute are sorted by default.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'has_archives' => array(
|
||||
'description' => __( 'If this attribute has term archive pages.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'If this attribute has term archive pages.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'count' => array(
|
||||
'description' => __( 'Number of terms in the attribute taxonomy.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Number of terms in the attribute taxonomy.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
|
|
|
@ -49,20 +49,20 @@ class ProductCategorySchema extends TermSchema {
|
|||
public function get_properties() {
|
||||
$schema = parent::get_properties();
|
||||
$schema['image'] = [
|
||||
'description' => __( 'Category image.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Category image.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit', 'embed' ],
|
||||
'readonly' => true,
|
||||
'properties' => $this->image_attachment_schema->get_properties(),
|
||||
];
|
||||
$schema['review_count'] = [
|
||||
'description' => __( 'Number of reviews for products in this category.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Number of reviews for products in this category.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
];
|
||||
$schema['permalink'] = [
|
||||
'description' => __( 'Category URL.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Category URL.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'format' => 'uri',
|
||||
'context' => [ 'view', 'edit', 'embed' ],
|
||||
|
|
|
@ -27,7 +27,7 @@ class ProductCollectionDataSchema extends AbstractSchema {
|
|||
public function get_properties() {
|
||||
return [
|
||||
'price_range' => [
|
||||
'description' => __( 'Min and max prices found in collection of products, provided using the smallest unit of the currency.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Min and max prices found in collection of products, provided using the smallest unit of the currency.', 'woocommerce' ),
|
||||
'type' => [ 'object', 'null' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -35,13 +35,13 @@ class ProductCollectionDataSchema extends AbstractSchema {
|
|||
$this->get_store_currency_properties(),
|
||||
[
|
||||
'min_price' => [
|
||||
'description' => __( 'Min price found in collection of products.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Min price found in collection of products.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'max_price' => [
|
||||
'description' => __( 'Max price found in collection of products.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Max price found in collection of products.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -50,7 +50,7 @@ class ProductCollectionDataSchema extends AbstractSchema {
|
|||
),
|
||||
],
|
||||
'attribute_counts' => [
|
||||
'description' => __( 'Returns number of products within attribute terms.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Returns number of products within attribute terms.', 'woocommerce' ),
|
||||
'type' => [ 'array', 'null' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -58,13 +58,13 @@ class ProductCollectionDataSchema extends AbstractSchema {
|
|||
'type' => 'object',
|
||||
'properties' => [
|
||||
'term' => [
|
||||
'description' => __( 'Term ID', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Term ID', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'count' => [
|
||||
'description' => __( 'Number of products.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Number of products.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -73,7 +73,7 @@ class ProductCollectionDataSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'rating_counts' => [
|
||||
'description' => __( 'Returns number of products with each average rating.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Returns number of products with each average rating.', 'woocommerce' ),
|
||||
'type' => [ 'array', 'null' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -81,13 +81,13 @@ class ProductCollectionDataSchema extends AbstractSchema {
|
|||
'type' => 'object',
|
||||
'properties' => [
|
||||
'rating' => [
|
||||
'description' => __( 'Average rating', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Average rating', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'count' => [
|
||||
'description' => __( 'Number of products.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Number of products.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -96,7 +96,7 @@ class ProductCollectionDataSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'stock_status_counts' => [
|
||||
'description' => __( 'Returns number of products with each stock status.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Returns number of products with each stock status.', 'woocommerce' ),
|
||||
'type' => [ 'array', 'null' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -104,13 +104,13 @@ class ProductCollectionDataSchema extends AbstractSchema {
|
|||
'type' => 'object',
|
||||
'properties' => [
|
||||
'status' => [
|
||||
'description' => __( 'Status', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Status', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'count' => [
|
||||
'description' => __( 'Number of products.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Number of products.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
|
|
@ -48,64 +48,64 @@ class ProductReviewSchema extends AbstractSchema {
|
|||
public function get_properties() {
|
||||
$properties = [
|
||||
'id' => [
|
||||
'description' => __( 'Unique identifier for the resource.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'date_created' => [
|
||||
'description' => __( "The date the review was created, in the site's timezone.", 'woo-gutenberg-products-block' ),
|
||||
'description' => __( "The date the review was created, in the site's timezone.", 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'format' => 'date-time',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'formatted_date_created' => [
|
||||
'description' => __( "The date the review was created, in the site's timezone in human-readable format.", 'woo-gutenberg-products-block' ),
|
||||
'description' => __( "The date the review was created, in the site's timezone in human-readable format.", 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'date_created_gmt' => [
|
||||
'description' => __( 'The date the review was created, as GMT.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The date the review was created, as GMT.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'format' => 'date-time',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'product_id' => [
|
||||
'description' => __( 'Unique identifier for the product that the review belongs to.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the product that the review belongs to.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'product_name' => [
|
||||
'description' => __( 'Name of the product that the review belongs to.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Name of the product that the review belongs to.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'product_permalink' => [
|
||||
'description' => __( 'Permalink of the product that the review belongs to.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Permalink of the product that the review belongs to.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'product_image' => [
|
||||
'description' => __( 'Image of the product that the review belongs to.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Image of the product that the review belongs to.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
'properties' => $this->image_attachment_schema->get_properties(),
|
||||
],
|
||||
'reviewer' => [
|
||||
'description' => __( 'Reviewer name.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Reviewer name.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'review' => [
|
||||
'description' => __( 'The content of the review.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The content of the review.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'arg_options' => [
|
||||
|
@ -114,13 +114,13 @@ class ProductReviewSchema extends AbstractSchema {
|
|||
'readonly' => true,
|
||||
],
|
||||
'rating' => [
|
||||
'description' => __( 'Review rating (0 to 5).', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Review rating (0 to 5).', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'verified' => [
|
||||
'description' => __( 'Shows if the reviewer bought the product or not.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Shows if the reviewer bought the product or not.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -134,14 +134,14 @@ class ProductReviewSchema extends AbstractSchema {
|
|||
foreach ( $avatar_sizes as $size ) {
|
||||
$avatar_properties[ $size ] = array(
|
||||
/* translators: %d: avatar image size in pixels */
|
||||
'description' => sprintf( __( 'Avatar URL with image size of %d pixels.', 'woo-gutenberg-products-block' ), $size ),
|
||||
'description' => sprintf( __( 'Avatar URL with image size of %d pixels.', 'woocommerce' ), $size ),
|
||||
'type' => 'string',
|
||||
'format' => 'uri',
|
||||
'context' => array( 'embed', 'view', 'edit' ),
|
||||
);
|
||||
}
|
||||
$properties['reviewer_avatar_urls'] = array(
|
||||
'description' => __( 'Avatar URLs for the object reviewer.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Avatar URLs for the object reviewer.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
|
|
|
@ -49,68 +49,68 @@ class ProductSchema extends AbstractSchema {
|
|||
public function get_properties() {
|
||||
return [
|
||||
'id' => [
|
||||
'description' => __( 'Unique identifier for the resource.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'name' => [
|
||||
'description' => __( 'Product name.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Product name.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
'slug' => [
|
||||
'description' => __( 'Product slug.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Product slug.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
'parent' => [
|
||||
'description' => __( 'ID of the parent product, if applicable.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'ID of the parent product, if applicable.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'type' => [
|
||||
'description' => __( 'Product type.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Product type.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'variation' => [
|
||||
'description' => __( 'Product variation attributes, if applicable.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Product variation attributes, if applicable.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
'permalink' => [
|
||||
'description' => __( 'Product URL.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Product URL.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'format' => 'uri',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'short_description' => [
|
||||
'description' => __( 'Product short description in HTML format.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Product short description in HTML format.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
'description' => [
|
||||
'description' => __( 'Product full description in HTML format.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Product full description in HTML format.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
'on_sale' => [
|
||||
'description' => __( 'Is the product on sale?', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Is the product on sale?', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'sku' => [
|
||||
'description' => __( 'Unique identifier.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
],
|
||||
'prices' => [
|
||||
'description' => __( 'Price data provided using the smallest unit of the currency.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Price data provided using the smallest unit of the currency.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -118,37 +118,37 @@ class ProductSchema extends AbstractSchema {
|
|||
$this->get_store_currency_properties(),
|
||||
[
|
||||
'price' => [
|
||||
'description' => __( 'Current product price.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Current product price.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'regular_price' => [
|
||||
'description' => __( 'Regular product price.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Regular product price.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'sale_price' => [
|
||||
'description' => __( 'Sale product price, if applicable.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Sale product price, if applicable.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'price_range' => [
|
||||
'description' => __( 'Price range, if applicable.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Price range, if applicable.', 'woocommerce' ),
|
||||
'type' => [ 'object', 'null' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
'properties' => [
|
||||
'min_amount' => [
|
||||
'description' => __( 'Price amount.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Price amount.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'max_amount' => [
|
||||
'description' => __( 'Price amount.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Price amount.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -159,25 +159,25 @@ class ProductSchema extends AbstractSchema {
|
|||
),
|
||||
],
|
||||
'price_html' => array(
|
||||
'description' => __( 'Price string formatted as HTML.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Price string formatted as HTML.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'average_rating' => [
|
||||
'description' => __( 'Reviews average rating.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Reviews average rating.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'review_count' => [
|
||||
'description' => __( 'Amount of reviews that the product has.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Amount of reviews that the product has.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'images' => [
|
||||
'description' => __( 'List of images.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of images.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'items' => [
|
||||
|
@ -186,32 +186,32 @@ class ProductSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'categories' => [
|
||||
'description' => __( 'List of categories, if applicable.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of categories, if applicable.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'items' => [
|
||||
'type' => 'object',
|
||||
'properties' => [
|
||||
'id' => [
|
||||
'description' => __( 'Category ID', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Category ID', 'woocommerce' ),
|
||||
'type' => 'number',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'name' => [
|
||||
'description' => __( 'Category name', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Category name', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'slug' => [
|
||||
'description' => __( 'Category slug', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Category slug', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'link' => [
|
||||
'description' => __( 'Category link', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Category link', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -220,32 +220,32 @@ class ProductSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'tags' => [
|
||||
'description' => __( 'List of tags, if applicable.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of tags, if applicable.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'items' => [
|
||||
'type' => 'object',
|
||||
'properties' => [
|
||||
'id' => [
|
||||
'description' => __( 'Tag ID', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Tag ID', 'woocommerce' ),
|
||||
'type' => 'number',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'name' => [
|
||||
'description' => __( 'Tag name', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Tag name', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'slug' => [
|
||||
'description' => __( 'Tag slug', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Tag slug', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'link' => [
|
||||
'description' => __( 'Tag link', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Tag link', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -254,63 +254,63 @@ class ProductSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'attributes' => [
|
||||
'description' => __( 'List of attributes (taxonomy terms) assigned to the product. For variable products, these are mapped to variations (see the `variations` field).', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of attributes (taxonomy terms) assigned to the product. For variable products, these are mapped to variations (see the `variations` field).', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'items' => [
|
||||
'type' => 'object',
|
||||
'properties' => [
|
||||
'id' => [
|
||||
'description' => __( 'The attribute ID, or 0 if the attribute is not taxonomy based.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The attribute ID, or 0 if the attribute is not taxonomy based.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'name' => [
|
||||
'description' => __( 'The attribute name.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The attribute name.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'taxonomy' => [
|
||||
'description' => __( 'The attribute taxonomy, or null if the attribute is not taxonomy based.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The attribute taxonomy, or null if the attribute is not taxonomy based.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'has_variations' => [
|
||||
'description' => __( 'True if this attribute is used by product variations.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'True if this attribute is used by product variations.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'terms' => [
|
||||
'description' => __( 'List of assigned attribute terms.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of assigned attribute terms.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'items' => [
|
||||
'type' => 'object',
|
||||
'properties' => [
|
||||
'id' => [
|
||||
'description' => __( 'The term ID, or 0 if the attribute is not a global attribute.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The term ID, or 0 if the attribute is not a global attribute.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'name' => [
|
||||
'description' => __( 'The term name.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The term name.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'slug' => [
|
||||
'description' => __( 'The term slug.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The term slug.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'default' => [
|
||||
'description' => __( 'If this is a default attribute', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'If this is a default attribute', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -322,33 +322,33 @@ class ProductSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'variations' => [
|
||||
'description' => __( 'List of variation IDs, if applicable.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of variation IDs, if applicable.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'items' => [
|
||||
'type' => 'object',
|
||||
'properties' => [
|
||||
'id' => [
|
||||
'description' => __( 'The attribute ID, or 0 if the attribute is not taxonomy based.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The attribute ID, or 0 if the attribute is not taxonomy based.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'attributes' => [
|
||||
'description' => __( 'List of variation attributes.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'List of variation attributes.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'items' => [
|
||||
'type' => 'object',
|
||||
'properties' => [
|
||||
'name' => [
|
||||
'description' => __( 'The attribute name.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The attribute name.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'value' => [
|
||||
'description' => __( 'The assigned attribute.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The assigned attribute.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
@ -360,79 +360,79 @@ class ProductSchema extends AbstractSchema {
|
|||
],
|
||||
],
|
||||
'has_options' => [
|
||||
'description' => __( 'Does the product have additional options before it can be added to the cart?', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Does the product have additional options before it can be added to the cart?', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'is_purchasable' => [
|
||||
'description' => __( 'Is the product purchasable?', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Is the product purchasable?', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'is_in_stock' => [
|
||||
'description' => __( 'Is the product in stock?', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Is the product in stock?', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'is_on_backorder' => [
|
||||
'description' => __( 'Is the product stock backordered? This will also return false if backorder notifications are turned off.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Is the product stock backordered? This will also return false if backorder notifications are turned off.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'low_stock_remaining' => [
|
||||
'description' => __( 'Quantity left in stock if stock is low, or null if not applicable.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Quantity left in stock if stock is low, or null if not applicable.', 'woocommerce' ),
|
||||
'type' => [ 'integer', 'null' ],
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'sold_individually' => [
|
||||
'description' => __( 'If true, only one item of this product is allowed for purchase in a single order.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'If true, only one item of this product is allowed for purchase in a single order.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'add_to_cart' => [
|
||||
'description' => __( 'Add to cart button parameters.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Add to cart button parameters.', 'woocommerce' ),
|
||||
'type' => 'object',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
'properties' => [
|
||||
'text' => [
|
||||
'description' => __( 'Button text.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Button text.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'description' => [
|
||||
'description' => __( 'Button description.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Button description.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'url' => [
|
||||
'description' => __( 'Add to cart URL.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Add to cart URL.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'minimum' => [
|
||||
'description' => __( 'The minimum quantity that can be added to the cart.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The minimum quantity that can be added to the cart.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'maximum' => [
|
||||
'description' => __( 'The maximum quantity that can be added to the cart.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The maximum quantity that can be added to the cart.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
],
|
||||
'multiple_of' => [
|
||||
'description' => __( 'The amount that quantities increment by. Quantity must be an multiple of this value.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'The amount that quantities increment by. Quantity must be an multiple of this value.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => [ 'view', 'edit' ],
|
||||
'readonly' => true,
|
||||
|
|
|
@ -61,7 +61,7 @@ class ShippingAddressSchema extends AbstractAddressSchema {
|
|||
'invalid_object_type',
|
||||
sprintf(
|
||||
/* translators: Placeholders are class and method names */
|
||||
__( '%1$s requires an instance of %2$s or %3$s for the address', 'woo-gutenberg-products-block' ),
|
||||
__( '%1$s requires an instance of %2$s or %3$s for the address', 'woocommerce' ),
|
||||
'ShippingAddressSchema::get_item_response',
|
||||
'WC_Customer',
|
||||
'WC_Order'
|
||||
|
|
|
@ -27,37 +27,37 @@ class TermSchema extends AbstractSchema {
|
|||
public function get_properties() {
|
||||
return [
|
||||
'id' => array(
|
||||
'description' => __( 'Unique identifier for the resource.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'name' => array(
|
||||
'description' => __( 'Term name.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Term name.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'slug' => array(
|
||||
'description' => __( 'String based identifier for the term.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'String based identifier for the term.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'description' => array(
|
||||
'description' => __( 'Term description.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Term description.', 'woocommerce' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'parent' => array(
|
||||
'description' => __( 'Parent term ID, if applicable.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Parent term ID, if applicable.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'count' => array(
|
||||
'description' => __( 'Number of objects (posts of any type) assigned to the term.', 'woo-gutenberg-products-block' ),
|
||||
'description' => __( 'Number of objects (posts of any type) assigned to the term.', 'woocommerce' ),
|
||||
'type' => 'integer',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
|
|
|
@ -26,7 +26,7 @@ class ArrayUtils {
|
|||
if ( $array ) {
|
||||
return sprintf(
|
||||
/* translators: 1: The first n-1 items of a list 2: the last item in the list. */
|
||||
__( '%1$s and %2$s', 'woo-gutenberg-products-block' ),
|
||||
__( '%1$s and %2$s', 'woocommerce' ),
|
||||
implode( ', ', $array ),
|
||||
$last
|
||||
);
|
||||
|
|
|
@ -188,13 +188,13 @@ class CartController {
|
|||
$cart_item = $this->get_cart_item( $item_id );
|
||||
|
||||
if ( empty( $cart_item ) ) {
|
||||
throw new RouteException( 'woocommerce_rest_cart_invalid_key', __( 'Cart item does not exist.', 'woo-gutenberg-products-block' ), 409 );
|
||||
throw new RouteException( 'woocommerce_rest_cart_invalid_key', __( 'Cart item does not exist.', 'woocommerce' ), 409 );
|
||||
}
|
||||
|
||||
$product = $cart_item['data'];
|
||||
|
||||
if ( ! $product instanceof \WC_Product ) {
|
||||
throw new RouteException( 'woocommerce_rest_cart_invalid_product', __( 'Cart item is invalid.', 'woo-gutenberg-products-block' ), 404 );
|
||||
throw new RouteException( 'woocommerce_rest_cart_invalid_product', __( 'Cart item is invalid.', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
$quantity_validation = ( new QuantityLimits() )->validate_cart_item_quantity( $quantity, $cart_item );
|
||||
|
@ -225,7 +225,7 @@ class CartController {
|
|||
'woocommerce_rest_product_out_of_stock',
|
||||
sprintf(
|
||||
/* translators: %s: product name */
|
||||
__( 'You cannot add "%s" to the cart because the product is out of stock.', 'woo-gutenberg-products-block' ),
|
||||
__( 'You cannot add "%s" to the cart because the product is out of stock.', 'woocommerce' ),
|
||||
$product->get_name()
|
||||
),
|
||||
400
|
||||
|
@ -241,7 +241,7 @@ class CartController {
|
|||
'woocommerce_rest_product_partially_out_of_stock',
|
||||
sprintf(
|
||||
/* translators: 1: product name 2: quantity in stock */
|
||||
__( 'You cannot add that amount of "%1$s" to the cart because there is not enough stock (%2$s remaining).', 'woo-gutenberg-products-block' ),
|
||||
__( 'You cannot add that amount of "%1$s" to the cart because there is not enough stock (%2$s remaining).', 'woocommerce' ),
|
||||
$product->get_name(),
|
||||
wc_format_stock_quantity_for_display( $qty_remaining, $product )
|
||||
),
|
||||
|
@ -348,48 +348,48 @@ class CartController {
|
|||
/* translators: %s: product name. */
|
||||
'singular' => __(
|
||||
'%s is out of stock and cannot be purchased. Please remove it from your cart.',
|
||||
'woo-gutenberg-products-block'
|
||||
'woocommerce'
|
||||
),
|
||||
/* translators: %s: product names. */
|
||||
'plural' => __(
|
||||
'%s are out of stock and cannot be purchased. Please remove them from your cart.',
|
||||
'woo-gutenberg-products-block'
|
||||
'woocommerce'
|
||||
),
|
||||
],
|
||||
'not_purchasable' => [
|
||||
/* translators: %s: product name. */
|
||||
'singular' => __(
|
||||
'%s cannot be purchased. Please remove it from your cart.',
|
||||
'woo-gutenberg-products-block'
|
||||
'woocommerce'
|
||||
),
|
||||
/* translators: %s: product names. */
|
||||
'plural' => __(
|
||||
'%s cannot be purchased. Please remove them from your cart.',
|
||||
'woo-gutenberg-products-block'
|
||||
'woocommerce'
|
||||
),
|
||||
],
|
||||
'too_many_in_cart' => [
|
||||
/* translators: %s: product names. */
|
||||
'singular' => __(
|
||||
'There are too many %s in the cart. Only 1 can be purchased. Please reduce the quantity in your cart.',
|
||||
'woo-gutenberg-products-block'
|
||||
'woocommerce'
|
||||
),
|
||||
/* translators: %s: product names. */
|
||||
'plural' => __(
|
||||
'There are too many %s in the cart. Only 1 of each can be purchased. Please reduce the quantities in your cart.',
|
||||
'woo-gutenberg-products-block'
|
||||
'woocommerce'
|
||||
),
|
||||
],
|
||||
'partial_out_of_stock' => [
|
||||
/* translators: %s: product names. */
|
||||
'singular' => __(
|
||||
'There is not enough %s in stock. Please reduce the quantity in your cart.',
|
||||
'woo-gutenberg-products-block'
|
||||
'woocommerce'
|
||||
),
|
||||
/* translators: %s: product names. */
|
||||
'plural' => __(
|
||||
'There are not enough %s in stock. Please reduce the quantities in your cart.',
|
||||
'woo-gutenberg-products-block'
|
||||
'woocommerce'
|
||||
),
|
||||
],
|
||||
];
|
||||
|
@ -401,7 +401,7 @@ class CartController {
|
|||
return $stock_error_messages[ $exception_type ][ $singular_or_plural ];
|
||||
}
|
||||
|
||||
return __( 'There was an error with an item in your cart.', 'woo-gutenberg-products-block' );
|
||||
return __( 'There was an error with an item in your cart.', 'woocommerce' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -725,7 +725,7 @@ class CartController {
|
|||
$cart = wc()->cart;
|
||||
|
||||
if ( ! $cart || ! $cart instanceof \WC_Cart ) {
|
||||
throw new RouteException( 'woocommerce_rest_cart_error', __( 'Unable to retrieve cart.', 'woo-gutenberg-products-block' ), 500 );
|
||||
throw new RouteException( 'woocommerce_rest_cart_error', __( 'Unable to retrieve cart.', 'woocommerce' ), 500 );
|
||||
}
|
||||
|
||||
return $cart;
|
||||
|
@ -861,10 +861,10 @@ class CartController {
|
|||
$index > 1 ?
|
||||
sprintf(
|
||||
/* translators: %d: shipping package number */
|
||||
_x( 'Shipment %d', 'shipping packages', 'woo-gutenberg-products-block' ),
|
||||
_x( 'Shipment %d', 'shipping packages', 'woocommerce' ),
|
||||
$index
|
||||
) :
|
||||
_x( 'Shipment 1', 'shipping packages', 'woo-gutenberg-products-block' ),
|
||||
_x( 'Shipment 1', 'shipping packages', 'woocommerce' ),
|
||||
$package['package_id'],
|
||||
$package
|
||||
);
|
||||
|
@ -905,7 +905,7 @@ class CartController {
|
|||
'woocommerce_rest_cart_coupon_error',
|
||||
sprintf(
|
||||
/* translators: %s coupon code */
|
||||
__( '"%s" is an invalid coupon code.', 'woo-gutenberg-products-block' ),
|
||||
__( '"%s" is an invalid coupon code.', 'woocommerce' ),
|
||||
esc_html( $coupon_code )
|
||||
),
|
||||
400
|
||||
|
@ -917,7 +917,7 @@ class CartController {
|
|||
'woocommerce_rest_cart_coupon_error',
|
||||
sprintf(
|
||||
/* translators: %s coupon code */
|
||||
__( 'Coupon code "%s" has already been applied.', 'woo-gutenberg-products-block' ),
|
||||
__( 'Coupon code "%s" has already been applied.', 'woocommerce' ),
|
||||
esc_html( $coupon_code )
|
||||
),
|
||||
400
|
||||
|
@ -961,7 +961,7 @@ class CartController {
|
|||
'woocommerce_rest_cart_coupon_error',
|
||||
sprintf(
|
||||
/* translators: %s: coupon code */
|
||||
__( '"%s" has already been applied and cannot be used in conjunction with other coupons.', 'woo-gutenberg-products-block' ),
|
||||
__( '"%s" has already been applied and cannot be used in conjunction with other coupons.', 'woocommerce' ),
|
||||
$code
|
||||
),
|
||||
400
|
||||
|
@ -1022,7 +1022,7 @@ class CartController {
|
|||
'woocommerce_rest_cart_coupon_error',
|
||||
sprintf(
|
||||
/* translators: %1$s coupon code, %2$s reason. */
|
||||
__( 'The "%1$s" coupon has been removed from your cart: %2$s', 'woo-gutenberg-products-block' ),
|
||||
__( 'The "%1$s" coupon has been removed from your cart: %2$s', 'woocommerce' ),
|
||||
$coupon->get_code(),
|
||||
wp_strip_all_tags( $coupon->get_error_message() )
|
||||
),
|
||||
|
@ -1072,7 +1072,7 @@ class CartController {
|
|||
if ( ! $product || 'trash' === $product->get_status() ) {
|
||||
throw new RouteException(
|
||||
'woocommerce_rest_cart_invalid_product',
|
||||
__( 'This product cannot be added to the cart.', 'woo-gutenberg-products-block' ),
|
||||
__( 'This product cannot be added to the cart.', 'woocommerce' ),
|
||||
400
|
||||
);
|
||||
}
|
||||
|
@ -1112,7 +1112,7 @@ class CartController {
|
|||
'woocommerce_rest_product_not_purchasable',
|
||||
sprintf(
|
||||
/* translators: %s: product name */
|
||||
__( '"%s" is not available for purchase.', 'woo-gutenberg-products-block' ),
|
||||
__( '"%s" is not available for purchase.', 'woocommerce' ),
|
||||
$product->get_name()
|
||||
),
|
||||
400
|
||||
|
@ -1231,7 +1231,7 @@ class CartController {
|
|||
throw new RouteException(
|
||||
'woocommerce_rest_invalid_variation_data',
|
||||
/* translators: %1$s: Attribute name, %2$s: Allowed values. */
|
||||
sprintf( __( 'Invalid value posted for %1$s. Allowed values: %2$s', 'woo-gutenberg-products-block' ), $attribute_label, implode( ', ', $attribute->get_slugs() ) ),
|
||||
sprintf( __( 'Invalid value posted for %1$s. Allowed values: %2$s', 'woocommerce' ), $attribute_label, implode( ', ', $attribute->get_slugs() ) ),
|
||||
400
|
||||
);
|
||||
}
|
||||
|
@ -1251,7 +1251,7 @@ class CartController {
|
|||
throw new RouteException(
|
||||
'woocommerce_rest_missing_variation_data',
|
||||
/* translators: %s: Attribute name. */
|
||||
__( 'Missing variation data for variable product.', 'woo-gutenberg-products-block' ) . ' ' . sprintf( _n( '%s is a required field', '%s are required fields', count( $missing_attributes ), 'woo-gutenberg-products-block' ), wc_format_list_of_items( $missing_attributes ) ),
|
||||
__( 'Missing variation data for variable product.', 'woocommerce' ) . ' ' . sprintf( _n( '%s is a required field', '%s are required fields', count( $missing_attributes ), 'woocommerce' ), wc_format_list_of_items( $missing_attributes ) ),
|
||||
400
|
||||
);
|
||||
}
|
||||
|
@ -1278,7 +1278,7 @@ class CartController {
|
|||
if ( empty( $variation_id ) ) {
|
||||
throw new RouteException(
|
||||
'woocommerce_rest_variation_id_from_variation_data',
|
||||
__( 'No matching variation found.', 'woo-gutenberg-products-block' ),
|
||||
__( 'No matching variation found.', 'woocommerce' ),
|
||||
400
|
||||
);
|
||||
}
|
||||
|
@ -1355,7 +1355,7 @@ class CartController {
|
|||
if ( ! $product || 'trash' === $product->get_status() ) {
|
||||
throw new RouteException(
|
||||
'woocommerce_rest_cart_invalid_parent_product',
|
||||
__( 'This product cannot be added to the cart.', 'woo-gutenberg-products-block' ),
|
||||
__( 'This product cannot be added to the cart.', 'woocommerce' ),
|
||||
400
|
||||
);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue