Skip to content

Commit

Permalink
Merge pull request #2555 from woocommerce/feature/2494-remove-pre-lau…
Browse files Browse the repository at this point in the history
…nch-checklist-items

Remove pre launch checklist items
  • Loading branch information
joemcgill authored Sep 5, 2024
2 parents d78738a + c5c547a commit 40bbf82
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 147 deletions.
53 changes: 3 additions & 50 deletions src/API/Site/Controllers/MerchantCenter/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected function get_settings_endpoint_edit_callback(): callable {
*/
protected function get_schema_properties(): array {
return [
'shipping_rate' => [
'shipping_rate' => [
'type' => 'string',
'description' => __(
'Whether shipping rate is a simple flat rate or needs to be configured manually in the Merchant Center.',
Expand All @@ -105,7 +105,7 @@ protected function get_schema_properties(): array {
'manual',
],
],
'shipping_time' => [
'shipping_time' => [
'type' => 'string',
'description' => __(
'Whether shipping time is a simple flat time or needs to be configured manually in the Merchant Center.',
Expand All @@ -118,7 +118,7 @@ protected function get_schema_properties(): array {
'manual',
],
],
'tax_rate' => [
'tax_rate' => [
'type' => 'string',
'description' => __(
'Whether tax rate is destination based or need to be configured manually in the Merchant Center.',
Expand All @@ -132,53 +132,6 @@ protected function get_schema_properties(): array {
],
'default' => 'destination',
],
'website_live' => [
'type' => 'boolean',
'description' => __( 'Whether the store website is live.', 'google-listings-and-ads' ),
'context' => [ 'view', 'edit' ],
'validate_callback' => 'rest_validate_request_arg',
'default' => false,
],
'checkout_process_secure' => [
'type' => 'boolean',
'description' => __(
'Whether the checkout process is complete and secure.',
'google-listings-and-ads'
),
'context' => [ 'view', 'edit' ],
'validate_callback' => 'rest_validate_request_arg',
'default' => false,
],
'payment_methods_visible' => [
'type' => 'boolean',
'description' => __(
'Whether the payment methods are visible on the website.',
'google-listings-and-ads'
),
'context' => [ 'view', 'edit' ],
'validate_callback' => 'rest_validate_request_arg',
'default' => false,
],
'refund_tos_visible' => [
'type' => 'boolean',
'description' => __(
'Whether the refund policy and terms of service are visible on the website.',
'google-listings-and-ads'
),
'context' => [ 'view', 'edit' ],
'validate_callback' => 'rest_validate_request_arg',
'default' => false,
],
'contact_info_visible' => [
'type' => 'boolean',
'description' => __(
'Whether the phone number, email, and/or address are visible on the website.',
'google-listings-and-ads'
),
'context' => [ 'view', 'edit' ],
'validate_callback' => 'rest_validate_request_arg',
'default' => false,
],
];
}

Expand Down
30 changes: 1 addition & 29 deletions src/MerchantCenter/MerchantCenterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public function get_setup_status(): array {
if ( $this->saved_target_audience() && $this->saved_shipping_and_tax_options() ) {
$step = 'store_requirements';

if ( $this->is_mc_contact_information_setup() && $this->checked_pre_launch_checklist() ) {
if ( $this->is_mc_contact_information_setup() ) {
$step = 'paid_ads';
}
}
Expand Down Expand Up @@ -348,34 +348,6 @@ protected function is_mc_contact_information_setup(): bool {
return $is_setup['phone_number'] && $is_setup['phone_number_verified'] && $is_setup['address'];
}

/**
* Check if all items in the pre-launch checklist have been checked.
*
* NOTE: This is a temporary method that will be replaced by the Policy Compliance Checks project.
*
* @return bool If all required items in the pre-launch checklist have been checked.
*
* @since 2.2.0
*/
protected function checked_pre_launch_checklist(): bool {
$settings = $this->options->get( OptionsInterface::MERCHANT_CENTER, [] );
$keys = [
'website_live',
'checkout_process_secure',
'payment_methods_visible',
'refund_tos_visible',
'contact_info_visible',
];

foreach ( $keys as $key ) {
if ( empty( $settings[ $key ] ) || $settings[ $key ] !== true ) {
return false;
}
}

return true;
}

/**
* Check if the taxes + shipping rate and time + free shipping settings have been saved.
*
Expand Down
56 changes: 0 additions & 56 deletions src/Value/MerchantCenterSettings.php

This file was deleted.

7 changes: 6 additions & 1 deletion tests/Tools/HelperTrait/ProductTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,12 @@ protected function generate_mock_image_attachment( int $product_id, string $imag
* @return WCProductAdapter The adapted products with the rules applied.
*/
protected function generate_attribute_mapping_adapted_product( $rules, $categories = [] ) {
$product = WC_Helper_Product::create_simple_product( false );
$product = WC_Helper_Product::create_simple_product(
false,
[
'sku' => 'Mapped Product SKU',
]
);

$attributes = [
WC_Helper_Product::create_product_attribute_object( 'size', [ 's', 'xs' ] ),
Expand Down
12 changes: 2 additions & 10 deletions tests/Unit/MerchantCenter/MerchantCenterServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,26 +511,18 @@ public function test_get_setup_status_step_paid_ads() {
$this->options->method( 'get_merchant_id' )->willReturn( 1234 );
$this->merchant_account_state->method( 'last_incomplete_step' )->willReturn( '' );
$this->ads_service->method( 'connected_account' )->willReturn( true );
$this->options->method( 'get' )
$this->options->expects( $this->exactly( 3 ) )->method( 'get' )
->withConsecutive(
[ OptionsInterface::MC_SETUP_COMPLETED_AT, false ],
[ OptionsInterface::TARGET_AUDIENCE ],
[ OptionsInterface::MERCHANT_CENTER, [] ],
[ OptionsInterface::MERCHANT_CENTER, [] ]
)->willReturnOnConsecutiveCalls(
false,
[
'location' => 'selected',
'countries' => [ 'GB' ],
],
[],
[
'website_live' => true,
'checkout_process_secure' => true,
'payment_methods_visible' => true,
'refund_tos_visible' => true,
'contact_info_visible' => true,
]
[]
);
$this->shipping_time_query->method( 'get_results' )
->willReturn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function test_maps_rules_product_fields_sku() {
$adapted_product = $this->generate_attribute_mapping_adapted_product( $rules );
$adapted_variation = $this->generate_attribute_mapping_adapted_product_variant( $rules );

$this->assertEquals( 'DUMMY SKU', $adapted_product->getGtin() );
$this->assertEquals( 'Mapped Product SKU', $adapted_product->getGtin() );
$this->assertEquals( 'DUMMY SKU VARIABLE HUGE BLUE ANY NUMBER', $adapted_variation->getGtin() );
}

Expand Down

0 comments on commit 40bbf82

Please sign in to comment.