Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Refactor/rebrand order received template to order confirmation (#9734)
Browse files Browse the repository at this point in the history
* rebrand order received to order confirmation

* updated descriptions for templates

* updated descriptions for order confirmation placeholder
  • Loading branch information
wavvves authored Jun 15, 2023
1 parent 39801df commit 43b9f6f
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 43 deletions.
12 changes: 6 additions & 6 deletions assets/js/blocks/classic-template/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ export const TYPES = {
productCatalog: 'product-catalog',
productTaxonomy: 'product-taxonomy',
productSearchResults: 'product-search-results',
orderReceived: 'order-received',
orderConfirmation: 'order-confirmation',
cart: 'cart',
checkout: 'checkout',
checkoutHeader: 'checkout-header',
};
export const PLACEHOLDERS = {
singleProduct: 'single-product',
archiveProduct: 'archive-product',
orderReceived: 'fallback',
orderConfirmation: 'fallback',
checkoutHeader: 'checkout-header',
};

Expand Down Expand Up @@ -90,9 +90,9 @@ export const TEMPLATES: TemplateDetails = {
title: __( 'Checkout Header', 'woo-gutenberg-products-block' ),
placeholder: 'checkout-header',
},
'order-received': {
type: TYPES.orderReceived,
title: __( 'Order Received Block', 'woo-gutenberg-products-block' ),
placeholder: PLACEHOLDERS.orderReceived,
'order-confirmation': {
type: TYPES.orderConfirmation,
title: __( 'Order Confirmation Block', 'woo-gutenberg-products-block' ),
placeholder: PLACEHOLDERS.orderConfirmation,
},
};
4 changes: 2 additions & 2 deletions assets/js/blocks/classic-template/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
} from './archive-product';
import * as blockifiedSingleProduct from './single-product';
import * as blockifiedProductSearchResults from './product-search-results';
import * as blockifiedOrderReceived from './order-received';
import * as blockifiedOrderConfirmation from './order-confirmation';

import type { BlockifiedTemplateConfig } from './types';

Expand All @@ -62,7 +62,7 @@ const conversionConfig: { [ key: string ]: BlockifiedTemplateConfig } = {
[ TYPES.productTaxonomy ]: blockifiedProductTaxonomyConfig,
[ TYPES.singleProduct ]: blockifiedSingleProduct,
[ TYPES.productSearchResults ]: blockifiedProductSearchResults,
[ TYPES.orderReceived ]: blockifiedOrderReceived,
[ TYPES.orderConfirmation ]: blockifiedOrderConfirmation,
fallback: blockifiedFallbackConfig,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const isConversionPossible = () => {

const getDescription = () => {
return __(
'This block represents the <strong>thankyou.php</strong> classic template. The actual rendered template may appear different from this placeholder.',
'This block represents the classic template used to display the order confirmation. The actual rendered template may appear different from this placeholder.',
'woo-gutenberg-products-block'
);
};
Expand All @@ -22,7 +22,7 @@ const getSkeleton = () => {
<h1>
{ __( 'Order received', 'woo-gutenberg-products-block' ) }
</h1>
<p className="woocommerce-notice woocommerce-notice--success woocommerce-thankyou-order-received">
<p className="woocommerce-notice woocommerce-notice--success woocommerce-thankyou-order-confirmation">
{ __(
'Thank you. Your order has been received.',
'woo-gutenberg-products-block'
Expand Down
6 changes: 3 additions & 3 deletions src/BlockTemplatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Automattic\WooCommerce\Blocks\Templates\ProductSearchResultsTemplate;
use Automattic\WooCommerce\Blocks\Templates\SingleProductTemplateCompatibility;
use Automattic\WooCommerce\Blocks\Utils\BlockTemplateUtils;
use Automattic\WooCommerce\Blocks\Templates\OrderReceivedTemplate;
use Automattic\WooCommerce\Blocks\Templates\OrderConfirmationTemplate;
use Automattic\WooCommerce\Blocks\Utils\SettingsUtils;
use \WP_Post;

Expand Down Expand Up @@ -631,8 +631,8 @@ public function render_block_template() {
add_filter( 'woocommerce_has_block_template', '__return_true', 10, 0 );
} elseif (
is_wc_endpoint_url( 'order-received' )
&& ! BlockTemplateUtils::theme_has_template( OrderReceivedTemplate::get_slug() )
&& $this->block_template_is_available( OrderReceivedTemplate::get_slug() )
&& ! BlockTemplateUtils::theme_has_template( OrderConfirmationTemplate::get_slug() )
&& $this->block_template_is_available( OrderConfirmationTemplate::get_slug() )
) {
add_filter( 'woocommerce_has_block_template', '__return_true', 10, 0 );
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/BlockTypes/ClassicTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use Automattic\WooCommerce\Blocks\Templates\ProductAttributeTemplate;
use Automattic\WooCommerce\Blocks\Templates\ProductSearchResultsTemplate;
use Automattic\WooCommerce\Blocks\Templates\OrderReceivedTemplate;
use Automattic\WooCommerce\Blocks\Templates\OrderConfirmationTemplate;
use Automattic\WooCommerce\Blocks\Utils\StyleAttributesUtils;
use WC_Shortcode_Checkout;

Expand Down Expand Up @@ -79,7 +79,7 @@ protected function render( $attributes, $content, $block ) {
$frontend_scripts::load_scripts();
}

if ( OrderReceivedTemplate::get_slug() === $attributes['template'] ) {
if ( OrderConfirmationTemplate::get_slug() === $attributes['template'] ) {
return $this->render_order_received();
}

Expand Down Expand Up @@ -121,7 +121,7 @@ protected function render( $attributes, $content, $block ) {
}

/**
* Render method for rendering the order received template.
* Render method for rendering the order confirmation template.
*
* @return string Rendered block type output.
*/
Expand All @@ -134,7 +134,7 @@ protected function render_order_received() {
'<%1$s %2$s>%3$s</%1$s>',
'h1',
get_block_wrapper_attributes(), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
esc_html__( 'Order received', 'woo-gutenberg-products-block' )
esc_html__( 'Order confirmation', 'woo-gutenberg-products-block' )
);

WC_Shortcode_Checkout::output( array() );
Expand Down
8 changes: 4 additions & 4 deletions src/Domain/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
use Automattic\WooCommerce\Blocks\Templates\CheckoutHeaderTemplate;
use Automattic\WooCommerce\Blocks\Templates\CheckoutTemplate;
use Automattic\WooCommerce\Blocks\Templates\ClassicTemplatesCompatibility;
use Automattic\WooCommerce\Blocks\Templates\OrderReceivedTemplate;
use Automattic\WooCommerce\Blocks\Templates\OrderConfirmationTemplate;
use Automattic\WooCommerce\Blocks\Templates\ProductAttributeTemplate;
use Automattic\WooCommerce\Blocks\Templates\ProductSearchResultsTemplate;
use Automattic\WooCommerce\Blocks\Templates\SingleProductTemplateCompatibility;
Expand Down Expand Up @@ -139,7 +139,7 @@ function() {
$this->container->get( CartTemplate::class );
$this->container->get( CheckoutTemplate::class );
$this->container->get( CheckoutHeaderTemplate::class );
$this->container->get( OrderReceivedTemplate::class );
$this->container->get( OrderConfirmationTemplate::class );
$this->container->get( ClassicTemplatesCompatibility::class );
$this->container->get( ArchiveProductTemplatesCompatibility::class )->init();
$this->container->get( SingleProductTemplateCompatibility::class )->init();
Expand Down Expand Up @@ -300,9 +300,9 @@ function () {
}
);
$this->container->register(
OrderReceivedTemplate::class,
OrderConfirmationTemplate::class,
function () {
return new OrderReceivedTemplate();
return new OrderConfirmationTemplate();
}
);
$this->container->register(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
namespace Automattic\WooCommerce\Blocks\Templates;

/**
* OrderReceivedTemplate class.
* OrderConfirmationTemplate class.
*
* @internal
*/
class OrderReceivedTemplate extends AbstractPageTemplate {
class OrderConfirmationTemplate extends AbstractPageTemplate {
/**
* Template slug.
*
* @return string
*/
public static function get_slug() {
return 'order-received';
return 'order-confirmation';
}

/**
Expand All @@ -40,6 +40,6 @@ protected function is_active_template() {
* @return string
*/
public static function get_template_title() {
return __( 'Order Received', 'woo-gutenberg-products-block' );
return __( 'Order Confirmation', 'woo-gutenberg-products-block' );
}
}
32 changes: 16 additions & 16 deletions src/Utils/BlockTemplateUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Automattic\WooCommerce\Blocks\Templates\CheckoutHeaderTemplate;
use Automattic\WooCommerce\Blocks\Templates\CheckoutTemplate;
use Automattic\WooCommerce\Blocks\Templates\MiniCartTemplate;
use Automattic\WooCommerce\Blocks\Templates\OrderReceivedTemplate;
use Automattic\WooCommerce\Blocks\Templates\OrderConfirmationTemplate;
use Automattic\WooCommerce\Blocks\Templates\ProductAttributeTemplate;
use Automattic\WooCommerce\Blocks\Templates\ProductSearchResultsTemplate;

Expand Down Expand Up @@ -307,49 +307,49 @@ public static function get_block_template_description( $template_slug ) {
*/
public static function get_plugin_block_template_types() {
return array(
'single-product' => array(
'single-product' => array(
'title' => _x( 'Single Product', 'Template name', 'woo-gutenberg-products-block' ),
'description' => __( 'Displays a single product.', 'woo-gutenberg-products-block' ),
),
'archive-product' => array(
'archive-product' => array(
'title' => _x( 'Product Catalog', 'Template name', 'woo-gutenberg-products-block' ),
'description' => __( 'Displays your products.', 'woo-gutenberg-products-block' ),
),
'taxonomy-product_cat' => array(
'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' ),
),
'taxonomy-product_tag' => array(
'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' ),
),
ProductAttributeTemplate::SLUG => array(
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' ),
),
ProductSearchResultsTemplate::SLUG => array(
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' ),
),
MiniCartTemplate::SLUG => array(
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' ),
),
CartTemplate::get_slug() => array(
CartTemplate::get_slug() => array(
'title' => _x( 'Cart', 'Template name', 'woo-gutenberg-products-block' ),
'description' => __( 'Template used to display the Cart.', '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' ),
),
CheckoutTemplate::get_slug() => array(
CheckoutTemplate::get_slug() => array(
'title' => _x( 'Checkout', 'Template name', 'woo-gutenberg-products-block' ),
'description' => __( 'Template used to display the Checkout.', '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' ),
),
CheckoutHeaderTemplate::SLUG => array(
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' ),
),
OrderReceivedTemplate::get_slug() => array(
'title' => _x( 'Order Received', 'Template name', 'woo-gutenberg-products-block' ),
'description' => __( 'Displays the order confirmation page.', 'woo-gutenberg-products-block' ),
OrderConfirmationTemplate::get_slug() => array(
'title' => _x( 'Order Confirmation', 'Template name', 'woo-gutenberg-products-block' ),
'description' => __( 'The Order Confirmation template provides customers with a summary of their completed purchase, including ordered items, shipping details, and order total. It serves as a receipt and confirmation of the successful transaction.', 'woo-gutenberg-products-block' ),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- wp:template-part {"slug":"header"} /-->
<!-- wp:group {"tagName": "main", "layout":{"inherit":true,"type":"constrained"}} -->
<main class="wp-block-group">
<!-- wp:woocommerce/legacy-template {"template":"order-received"} /-->
<!-- wp:woocommerce/legacy-template {"template":"order-confirmation"} /-->
</main>
<!-- /wp:group -->
<!-- wp:template-part {"slug":"footer"} /-->
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- wp:template-part {"slug":"header"} /-->
<!-- wp:group {"tagName": "main", "layout":{"inherit":true,"type":"constrained"}} -->
<main class="wp-block-group">
<!-- wp:woocommerce/legacy-template {"template":"order-received"} /-->
<!-- wp:woocommerce/legacy-template {"template":"order-confirmation"} /-->
</main>
<!-- /wp:group -->
<!-- wp:template-part {"slug":"footer"} /-->

0 comments on commit 43b9f6f

Please sign in to comment.