This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hide the shipping address form from Checkout Block in Editor and ren…
…ame the Billing Address label when "Force shipping to the customer billing address" is enabled. (#7800) * Rename billing address labels and hide shipping address from the editor when Force shipping to the customer billing address is enabled
- Loading branch information
Tarun Vijwani
authored
Dec 2, 2022
1 parent
79e7d22
commit 1f27302
Showing
8 changed files
with
125 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/constants.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
export const DEFAULT_TITLE = __( | ||
'Billing address', | ||
'woo-gutenberg-products-block' | ||
); | ||
export const DEFAULT_DESCRIPTION = __( | ||
'Enter the billing address that matches your payment method.', | ||
'woo-gutenberg-products-block' | ||
); | ||
|
||
export const DEFAULT_FORCED_BILLING_TITLE = __( | ||
'Billing and shipping address', | ||
'woo-gutenberg-products-block' | ||
); | ||
export const DEFAULT_FORCED_BILLING_DESCRIPTION = __( | ||
'Enter the billing and shipping address that matches your payment method.', | ||
'woo-gutenberg-products-block' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/utils.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { | ||
DEFAULT_TITLE, | ||
DEFAULT_DESCRIPTION, | ||
DEFAULT_FORCED_BILLING_DESCRIPTION, | ||
DEFAULT_FORCED_BILLING_TITLE, | ||
} from './constants'; | ||
|
||
export const getBillingAddresssBlockTitle = ( | ||
title: string, | ||
forcedBillingAddress: boolean | ||
): string => { | ||
if ( forcedBillingAddress ) { | ||
// Returns default forced billing title when forced billing address is enabled and there is no title set. | ||
return title === DEFAULT_TITLE ? DEFAULT_FORCED_BILLING_TITLE : title; | ||
} | ||
// Returns default title when forced billing address is disabled and there is no title set. | ||
return title === DEFAULT_FORCED_BILLING_TITLE ? DEFAULT_TITLE : title; | ||
}; | ||
|
||
export const getBillingAddresssBlockDescription = ( | ||
description: string, | ||
forcedBillingAddress: boolean | ||
): string => { | ||
if ( forcedBillingAddress ) { | ||
// Returns default forced billing description when forced billing address is enabled and there is no description set. | ||
return description === DEFAULT_DESCRIPTION | ||
? DEFAULT_FORCED_BILLING_DESCRIPTION | ||
: description; | ||
} | ||
|
||
// Returns default description when forced billing address is disabled and there is no description set. | ||
return description === DEFAULT_FORCED_BILLING_DESCRIPTION | ||
? DEFAULT_DESCRIPTION | ||
: description; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters