Skip to content

Commit

Permalink
Merge pull request #2766 from woocommerce/release/2.9.5
Browse files Browse the repository at this point in the history
Release 2.9.5
  • Loading branch information
mikkamp authored Jan 15, 2025
2 parents 8e4b580 + 78c11eb commit f25f66c
Show file tree
Hide file tree
Showing 180 changed files with 1,961 additions and 1,661 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ If you have a WooCommerce.com account, you can [start a chat or open a ticket on

We aim to support the latest two minor versions of WordPress, WooCommerce, and PHP. (L-2 policy)

- WordPress 5.9+
- WordPress 6.1+
- WooCommerce 7.9+
- PHP 7.4+ (64 bits)

Expand Down
17 changes: 17 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
*** Google for WooCommerce Changelog ***

= 2.9.5 - 2025-01-15 =
* Dev - Fix E2E tests in WC 9.6.
* Dev - Fix tests in WooCommerce 9.6.
* Fix - Avoid the negative shipping rate taken from WooCommerce settings leading to false onboarding completion and make its error message more explicit.
* Fix - Show leaving prompt in Edit Ads Campaign if the form was modified.
* Fix - Sync shipping max times to Google Merchant Center.
* Tweak - Add an admin service provider for WP Admin requests.
* Tweak - Conditionally load job classes.
* Tweak - Consistent usage of ContainerAware.
* Tweak - Pop up confirmation prompt on the Shipping page before saving changes.
* Tweak - Refactor installer class to load dependencies when needed.
* Tweak - Remove unused Http proxy class.
* Tweak - WC 9.6 compatibility.
* Update - Drop support for WordPress < 6.1.
* Update - Move tax rate setup from the Edit free listings page to the Settings page.
* Update - Move the Edit free listings page to a dedicated page and rename the page to Shipping.

= 2.9.4 - 2024-12-25 =
* Fix - Clear previous errors after completing sync.
* Tweak - Adjust conditions for MCM.
Expand Down
8 changes: 4 additions & 4 deletions google-listings-and-ads.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
* Plugin Name: Google for WooCommerce
* Plugin URL: https://wordpress.org/plugins/google-listings-and-ads/
* Description: Native integration with Google that allows merchants to easily display their products across Google’s network.
* Version: 2.9.4
* Version: 2.9.5
* Author: WooCommerce
* Author URI: https://woocommerce.com/
* Text Domain: google-listings-and-ads
* Requires at least: 5.9
* Requires at least: 6.1
* Tested up to: 6.7
* Requires PHP: 7.4
* Requires PHP Architecture: 64 bits
* Requires Plugins: woocommerce
* WC requires at least: 7.9
* WC tested up to: 9.5
* WC tested up to: 9.6
* Woo:
*
* @package WooCommerce\Admin
Expand All @@ -30,7 +30,7 @@

defined( 'ABSPATH' ) || exit;

define( 'WC_GLA_VERSION', '2.9.4' ); // WRCS: DEFINED_VERSION.
define( 'WC_GLA_VERSION', '2.9.5' ); // WRCS: DEFINED_VERSION.
define( 'WC_GLA_MIN_PHP_VER', '7.4' );
define( 'WC_GLA_MIN_WC_VER', '7.9' );

Expand Down
34 changes: 0 additions & 34 deletions js/src/components/conditional-section.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ exports[`checkErrors Audience When the audience location option is an invalid va

exports[`checkErrors Audience When the audience location option is an invalid value or missing, should not pass 2`] = `"Please select a location option."`;

exports[`checkErrors For tax rate, if store country code or selected country codes include 'US' When the tax rate option is an invalid value or missing, should not pass 1`] = `"Please specify tax rate option."`;

exports[`checkErrors For tax rate, if store country code or selected country codes include 'US' When the tax rate option is an invalid value or missing, should not pass 2`] = `"Please specify tax rate option."`;

exports[`checkErrors For tax rate, if store country code or selected country codes include 'US' When the tax rate option is an invalid value or missing, should not pass 3`] = `"Please specify tax rate option."`;

exports[`checkErrors For tax rate, if store country code or selected country codes include 'US' When the tax rate option is an invalid value or missing, should not pass 4`] = `"Please specify tax rate option."`;

exports[`checkErrors Offer free shipping With flat shipping rate option When there are some non-free shipping rates, and offer free shipping is checked, and there is no minimum order amount for non-free shipping rates, should not pass 1`] = `"Please enter minimum order for free shipping."`;

exports[`checkErrors Shipping rates For flat type When there are any selected countries with shipping rates not set, should not pass 1`] = `"Please specify estimated shipping rates for all the countries, and the rate cannot be less than 0."`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,8 @@ import { __ } from '@wordpress/i18n';
const validlocationSet = new Set( [ 'all', 'selected' ] );
const validShippingRateSet = new Set( [ 'automatic', 'flat', 'manual' ] );
const validShippingTimeSet = new Set( [ 'flat', 'manual' ] );
const validTaxRateSet = new Set( [ 'destination', 'manual' ] );

const checkErrors = (
values,
shippingTimes,
finalCountryCodes,
storeCountryCode,
hideTaxRates = false
) => {
const checkErrors = ( values, shippingTimes, finalCountryCodes ) => {
const errors = {};

// Check audience.
Expand Down Expand Up @@ -102,20 +95,6 @@ const checkErrors = (
);
}

/**
* Check tax rate (required for U.S. only).
*/
if (
! hideTaxRates &&
( storeCountryCode === 'US' || finalCountryCodes.includes( 'US' ) ) &&
! validTaxRateSet.has( values.tax_rate )
) {
errors.tax_rate = __(
'Please specify tax rate option.',
'google-listings-and-ads'
);
}

return errors;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ describe( 'checkErrors', () => {
countries: [ 'US', 'JP' ],
shipping_rate: 'flat',
shipping_time: 'flat',
tax_rate: 'manual',
shipping_country_rates: toRates( [ 'US', 10 ], [ 'JP', 30, 88 ] ),
offer_free_shipping: true,
};
Expand Down Expand Up @@ -436,72 +435,4 @@ describe( 'checkErrors', () => {
} );
} );
} );

describe( `For tax rate, if store country code or selected country codes include 'US'`, () => {
let codes;

beforeEach( () => {
codes = [ 'US' ];
} );

it( `When the tax rate option is an invalid value or missing, should not pass`, () => {
// Not set yet
let errors = checkErrors( defaultFormValues, [], codes );

expect( errors ).toHaveProperty( 'tax_rate' );
expect( errors.tax_rate ).toMatchSnapshot();

errors = checkErrors( defaultFormValues, [], [], 'US' );

expect( errors ).toHaveProperty( 'tax_rate' );
expect( errors.tax_rate ).toMatchSnapshot();

// Invalid value
errors = checkErrors(
{ ...defaultFormValues, tax_rate: true },
[],
codes
);

expect( errors ).toHaveProperty( 'tax_rate' );
expect( errors.tax_rate ).toMatchSnapshot();

// Invalid value
errors = checkErrors(
{ ...defaultFormValues, tax_rate: 'invalid' },
[],
codes
);

expect( errors ).toHaveProperty( 'tax_rate' );
expect( errors.tax_rate ).toMatchSnapshot();
} );

it( 'When the tax rate option is a valid value, should pass', () => {
// Selected destination
const destinationTaxRate = {
...defaultFormValues,
tax_rate: 'destination',
};

let errors = checkErrors( destinationTaxRate, [], codes );

expect( errors ).not.toHaveProperty( 'tax_rate' );

errors = checkErrors( destinationTaxRate, [], [], 'US' );

expect( errors ).not.toHaveProperty( 'tax_rate' );

// Selected manual
const manualTaxRate = { ...defaultFormValues, tax_rate: 'manual' };

errors = checkErrors( manualTaxRate, [], codes );

expect( errors ).not.toHaveProperty( 'tax_rate' );

errors = checkErrors( destinationTaxRate, [], [], 'US' );

expect( errors ).not.toHaveProperty( 'tax_rate' );
} );
} );
} );
Original file line number Diff line number Diff line change
@@ -1,76 +1,33 @@
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import { useAdaptiveFormContext } from '~/components/adaptive-form';
import StepContent from '~/components/stepper/step-content';
import StepContentActions from '~/components/stepper/step-content-actions';
import StepContentFooter from '~/components/stepper/step-content-footer';
import TaxRate from '~/pages/settings/setup-tax-rate/tax-rate';
import useDisplayTaxRate from '~/pages/settings/setup-tax-rate/useDisplayTaxRate';
import ChooseAudienceSection from '~/components/free-listings/choose-audience-section';
import ShippingRateSection from '~/components/shipping-rate-section';
import ShippingTimeSection from '~/components/free-listings/configure-product-listings/shipping-time-section';
import AppButton from '~/components/app-button';
import ConditionalSection from '~/components/conditional-section';
import OrderValueConditionSection from '~/components/order-value-condition-section';
import isNonFreeShippingRate from '~/utils/isNonFreeShippingRate';

/**
* Form to configure free listigns.
*
* @param {Object} props React props.
* @param {string} [props.submitLabel="Complete setup"] Submit button label.
* @param {boolean} [props.hideTaxRates] Whether to hide tax rate section.
*/
const FormContent = ( {
submitLabel = __( 'Complete setup', 'google-listings-and-ads' ),
hideTaxRates,
} ) => {
const { values, isValidForm, handleSubmit, adapter } =
useAdaptiveFormContext();
const displayTaxRate = useDisplayTaxRate( adapter.audienceCountries );
const shouldDisplayTaxRate = ! hideTaxRates && displayTaxRate;
const FormContent = () => {
const { values } = useAdaptiveFormContext();

const shouldDisplayShippingTime = values.shipping_time === 'flat';
const shouldDisplayOrderValueCondition =
values.shipping_rate === 'flat' &&
values.shipping_country_rates.some( isNonFreeShippingRate );

const handleSubmitClick = ( event ) => {
if ( shouldDisplayTaxRate !== null && isValidForm ) {
return handleSubmit( event );
}

adapter.showValidation();
};

return (
<StepContent>
<>
<ChooseAudienceSection />
<ShippingRateSection />
{ shouldDisplayOrderValueCondition && (
<OrderValueConditionSection />
) }
{ shouldDisplayShippingTime && <ShippingTimeSection /> }
<ConditionalSection show={ shouldDisplayTaxRate }>
<TaxRate />
</ConditionalSection>
<StepContentFooter>
<StepContentActions>
<AppButton
isPrimary
loading={ adapter.isSubmitting }
onClick={ handleSubmitClick }
>
{ submitLabel }
</AppButton>
</StepContentActions>
</StepContentFooter>
</StepContent>
</>
);
};

Expand Down
Loading

0 comments on commit f25f66c

Please sign in to comment.