Merge pull request #876 from woocommerce/PCP-900-onboard-with-pui-checkbox-automatically-set-when-shop-is-set-to-germany

Onboard with PUI Checkbox automatically set when shop is set to Germany
This commit is contained in:
Emili Castells 2022-10-14 09:11:55 +02:00 committed by GitHub
commit ab23dfbe4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View file

@ -80,10 +80,16 @@ class OnboardingOptionsRenderer {
*/
private function render_pui_option(): string {
if ( 'DE' === $this->country ) {
$checked = 'checked';
if ( $this->settings->has( 'ppcp-onboarding-pui' ) && $this->settings->get( 'ppcp-onboarding-pui' ) !== '1' ) {
$checked = '';
try {
$onboard_with_pui = $this->settings->get( 'ppcp-onboarding-pui' );
if ( $onboard_with_pui === '1' ) {
$checked = 'checked';
}
} catch ( NotFoundException $exception ) {
$checked = '';
}
return '<li><label><input type="checkbox" id="ppcp-onboarding-pui" ' . $checked . '> ' .
__( 'Onboard with Pay upon Invoice', 'woocommerce-paypal-payments' ) . '
</label></li>';