Skip to content

Commit

Permalink
Merge branch 'trunk' into multiple-variations-support
Browse files Browse the repository at this point in the history
  • Loading branch information
faisal-alvi committed Jan 23, 2025
2 parents 51532ee + 755bb62 commit 122ca65
Show file tree
Hide file tree
Showing 28 changed files with 99 additions and 72 deletions.
8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
*** WooCommerce Square Changelog ***

= 4.8.5 - 2025-01-20 =
* Fix - Unblock the Checkout page UI, and show a generic error when buyer verification fails.
* Fix - Ensure inventory sync works correctly for variable products when Square sync is enabled through quick or bulk edit.
* Dev - Bump WooCommerce "tested up to" version 9.6.
* Dev - Bump WooCommerce minimum supported version to 9.4.
* Dev - Use the `@woocommerce/e2e-utils-playwright` NPM package for E2E tests.
* Dev - Updates GitHub `actions/cache`, `actions/upload` and `actions/download` to v4 due to deprecation.

= 4.8.4 - 2024-12-09 =
* Fix - Resolved the product duplication issue on the Square side when WooCommerce is set as the SOR.
* Fix - Remove `woocommerce_loop_add_to_cart_link` filter to standardize "Buy Gift Card" and "Add to Cart" button styles across themes.
Expand Down
5 changes: 5 additions & 0 deletions includes/Handlers/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,11 @@ public function set_synced_with_square( $product ) {
if ( is_string( $square_synced ) ) {
$errors = $this->check_product_sync_errors( $product );
if ( 'no' === $square_synced || empty( $errors ) ) {
if ( 'yes' === $square_synced && $product->is_type( 'variable' ) && wc_square()->get_settings_handler()->is_inventory_sync_enabled() ) {
// if syncing inventory with Square, parent variable products don't manage stock
$product->set_manage_stock( false );
}

Product::set_synced_with_square( $product, $square_synced );
} elseif ( ! empty( $errors ) ) {
foreach ( $errors as $error ) {
Expand Down
16 changes: 14 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "git://github.com/woocommerce/woocommerce-square.git"
},
"title": "WooCommerce Square",
"version": "4.8.4",
"version": "4.8.5",
"homepage": "https://woocommerce.com/products/woocommerce-square/",
"scripts": {
"build": "composer install --no-dev && npm run build:webpack && npm run makepot && npm run archive",
Expand All @@ -34,6 +34,7 @@
"devDependencies": {
"@playwright/test": "^1.44.1",
"@woocommerce/dependency-extraction-webpack-plugin": "^3.0.1",
"@woocommerce/e2e-utils-playwright": "^0.2.1",
"@woocommerce/eslint-plugin": "^2.3.0",
"@woocommerce/woocommerce-rest-api": "^1.0.1",
"@wordpress/env": "^10.0.0",
Expand Down
10 changes: 9 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: credit card, square, woocommerce, inventory sync
Requires at least: 6.5
Tested up to: 6.7
Requires PHP: 7.4
Stable tag: 4.8.4
Stable tag: 4.8.5
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -72,6 +72,14 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o

== Changelog ==

= 4.8.5 - 2025-01-20 =
* Fix - Unblock the Checkout page UI, and show a generic error when buyer verification fails.
* Fix - Ensure inventory sync works correctly for variable products when Square sync is enabled through quick or bulk edit.
* Dev - Bump WooCommerce "tested up to" version 9.6.
* Dev - Bump WooCommerce minimum supported version to 9.4.
* Dev - Use the `@woocommerce/e2e-utils-playwright` NPM package for E2E tests.
* Dev - Updates GitHub `actions/cache`, `actions/upload` and `actions/download` to v4 due to deprecation.

= 4.8.4 - 2024-12-09 =
* Fix - Resolved the product duplication issue on the Square side when WooCommerce is set as the SOR.
* Fix - Remove `woocommerce_loop_add_to_cart_link` filter to standardize "Buy Gift Card" and "Add to Cart" button styles across themes.
Expand Down
8 changes: 7 additions & 1 deletion src/js/frontend/wc-square.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ jQuery( document ).ready( ( $ ) => {
false,
verificationResult
);
})
.catch(error => {
this.handle_errors([ error ]);
});
});
} else {
Expand Down Expand Up @@ -421,7 +424,10 @@ jQuery( document ).ready( ( $ ) => {
false,
verificationResult
);
});
})
.catch(error => {
this.handle_errors([ error ]);
});;
});
}

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/a6.transaction-authorize.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { chromium } from 'playwright';
import { test, expect } from '@playwright/test';
import { addOneOrMoreProductToCart } from '@woocommerce/e2e-utils-playwright';
import {
createProduct,
doesProductExist,
Expand Down Expand Up @@ -60,8 +61,7 @@ for ( const isBlock of isBlockCheckout ) {
test( title + 'Payment Gateway > Transaction Type > Authorization @general', async ( {
page,
} ) => {
await page.goto( '/product/simple-product' );
await page.locator( '.single_add_to_cart_button' ).click();
await addOneOrMoreProductToCart( page, 'simple-product' );

await visitCheckout( page, isBlock );
await fillAddressFields( page, isBlock );
Expand Down
7 changes: 3 additions & 4 deletions tests/e2e/specs/a7.transaction-authorize-virtual-only.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { chromium } from 'playwright';
import { test, expect } from '@playwright/test';
import { addOneOrMoreProductToCart } from '@woocommerce/e2e-utils-playwright';
import {
createProduct,
doesProductExist,
Expand Down Expand Up @@ -53,8 +54,7 @@ test.beforeAll( 'Setup', async ( { baseURL } ) => {
test( 'Payment Gateway > Transaction Type > Authorization + Virtual Only @general', async ( {
page,
} ) => {
await page.goto( '/product/virtual-product' );
await page.locator( '.single_add_to_cart_button' ).click();
await addOneOrMoreProductToCart( page, 'virtual-product' );

await visitCheckout( page, false );
await fillAddressFields( page, false );
Expand Down Expand Up @@ -93,8 +93,7 @@ test( 'Payment Gateway > Transaction Type > Authorization + Virtual Only but cha

await savePaymentGatewaySettings( page );

await page.goto( '/product/virtual-product' );
await page.locator( '.single_add_to_cart_button' ).click();
await addOneOrMoreProductToCart( page, 'virtual-product' );

await visitCheckout( page, false );
await fillAddressFields( page, false );
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/a8.transaction-authorize-paid-order.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { chromium } from 'playwright';
import { test, expect } from '@playwright/test';
import { addOneOrMoreProductToCart } from '@woocommerce/e2e-utils-playwright';
import {
createProduct,
doesProductExist,
Expand Down Expand Up @@ -47,8 +48,7 @@ test.beforeAll( 'Setup', async ( { baseURL } ) => {
test( 'Payment Gateway > Transaction Type > Authorization + Capture Paid Orders @general', async ( {
page,
} ) => {
await page.goto( '/product/simple-product' );
await page.locator( '.single_add_to_cart_button' ).click();
await addOneOrMoreProductToCart( page, 'simple-product' );

await visitCheckout( page, false );
await fillAddressFields( page, false );
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/a9.transaction-capture.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { chromium } from 'playwright';
import { test, expect } from '@playwright/test';
import { addOneOrMoreProductToCart } from '@woocommerce/e2e-utils-playwright';
import {
fillAddressFields,
fillCreditCardFields,
Expand Down Expand Up @@ -31,8 +32,7 @@ test.beforeAll( 'Setup', async ( { baseURL } ) => {
test( 'Payment Gateway > Transaction Type > Authorization @general', async ( {
page,
} ) => {
await page.goto( '/product/simple-product' );
await page.locator( '.single_add_to_cart_button' ).click();
await addOneOrMoreProductToCart( page, 'simple-product' );

await visitCheckout( page, false );
await fillAddressFields( page, false );
Expand Down
5 changes: 2 additions & 3 deletions tests/e2e/specs/a91.card-logos.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { test, expect } from '@playwright/test';
import { chromium } from 'playwright';
import { addOneOrMoreProductToCart } from '@woocommerce/e2e-utils-playwright';
import { savePaymentGatewaySettings } from '../utils/helper';


test( 'Payment Gateway - Accepted Card Logos @general', async ( { page } ) => {
await page.goto( '/product/simple-product' );
await page.locator( '.single_add_to_cart_button' ).click();
await addOneOrMoreProductToCart( page, 'simple-product' );
await page.goto( '/checkout-old' );

await expect(
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/a92.currency-support.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test, expect } from '@playwright/test';
import { chromium } from 'playwright';
import { addOneOrMoreProductToCart } from '@woocommerce/e2e-utils-playwright';

import {
visitCheckout,
Expand All @@ -26,8 +27,7 @@ test.beforeAll( 'Setup', async ( { baseURL } ) => {
test( 'Square credit card should available only for the supported currencies @general', async ( { page } ) => {
// Update currency to INR
await runWpCliCommand('wp option update woocommerce_currency "INR"');
await page.goto( '/product/simple-product' );
await page.locator( '.single_add_to_cart_button' ).click();
await addOneOrMoreProductToCart( page, 'simple-product' );
// Confirm that the Credit card is not visible on checkout page.
await visitCheckout(page, false);
await expect(
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/a93.credit-card-form-fields.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test, expect } from '@playwright/test';
import { chromium } from 'playwright';
import { addOneOrMoreProductToCart } from '@woocommerce/e2e-utils-playwright';

import {
visitCheckout,
Expand All @@ -23,8 +24,7 @@ test.beforeAll( 'Setup', async ( { baseURL } ) => {
} );

test( 'Verify square credit card form fields @general', async ( { page } ) => {
await page.goto( '/product/simple-product' );
await page.locator( '.single_add_to_cart_button' ).click();
await addOneOrMoreProductToCart( page, 'simple-product' );
// Confirm that the Credit card is not visible on checkout page.
await visitCheckout(page, true);

Expand Down
7 changes: 3 additions & 4 deletions tests/e2e/specs/b1.tokenization.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test, expect } from '@playwright/test';
import { chromium } from 'playwright';
import { addOneOrMoreProductToCart } from '@woocommerce/e2e-utils-playwright';

import {
fillAddressFields,
Expand Down Expand Up @@ -45,8 +46,7 @@ for ( const isBlock of isBlockCheckout ) {

test( title + 'Payment Gateway - Customer Profiles @general', async ( { page } ) => {
await deleteAllPaymentMethods( page );
await page.goto( '/product/simple-product' );
await page.locator( '.single_add_to_cart_button' ).click();
await addOneOrMoreProductToCart( page, 'simple-product' );
await visitCheckout( page, isBlock );

await fillAddressFields( page, isBlock );
Expand Down Expand Up @@ -79,8 +79,7 @@ for ( const isBlock of isBlockCheckout ) {
} );

test( title + 'Checkout using saved card @general', async ( { page } ) => {
await page.goto( '/product/simple-product' );
await page.locator( '.single_add_to_cart_button' ).click();
await addOneOrMoreProductToCart( page, 'simple-product' );
await visitCheckout( page, isBlock );

if ( isBlock ) {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/b3.gift-card-full-payment.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test, expect } from '@playwright/test';
import { chromium } from 'playwright';
import { addOneOrMoreProductToCart } from '@woocommerce/e2e-utils-playwright';

import {
createProduct,
Expand Down Expand Up @@ -40,8 +41,7 @@ test.beforeAll( 'Setup', async ( { baseURL } ) => {
let orderId;

test( 'Gift card - Full payment @giftcard', async ( { page } ) => {
await page.goto( '/product/dollar-product' );
await page.locator( '.single_add_to_cart_button' ).click();
await addOneOrMoreProductToCart( page, 'dollar-product' );

await page.goto( '/checkout-old' );
await fillAddressFields( page, false );
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/b4.gift-card-partial-payment.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test, expect } from '@playwright/test';
import { chromium } from 'playwright';
import { addOneOrMoreProductToCart } from '@woocommerce/e2e-utils-playwright';

import {
createProduct,
Expand Down Expand Up @@ -43,8 +44,7 @@ test.beforeAll( 'Setup', async ( { baseURL } ) => {
let orderId = 0;

test( 'Gift card - Partial payment @giftcard', async ( { page } ) => {
await page.goto( '/product/simple-product' );
await page.locator( '.single_add_to_cart_button' ).click();
await addOneOrMoreProductToCart( page, 'simple-product' );

await page.goto( '/checkout-old' );
await fillAddressFields( page, false );
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/b5.gift-card-full-refund.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test, expect } from '@playwright/test';
import { chromium } from 'playwright';
import { addOneOrMoreProductToCart } from '@woocommerce/e2e-utils-playwright';

import {
createProduct,
Expand Down Expand Up @@ -41,8 +42,7 @@ test.beforeAll( 'Setup', async ( { baseURL } ) => {

test( 'Full Refund Gift card order @giftcard', async ( { page } ) => {
page.on('dialog', dialog => dialog.accept());
await page.goto( '/product/dollar-product' );
await page.locator( '.single_add_to_cart_button' ).click();
await addOneOrMoreProductToCart( page, 'dollar-product' );

await page.goto( '/checkout-old' );
await fillAddressFields( page, false );
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/b6.gift-card-partial-refund.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test, expect } from '@playwright/test';
import { chromium } from 'playwright';
import { addOneOrMoreProductToCart } from '@woocommerce/e2e-utils-playwright';

import {
createProduct,
Expand Down Expand Up @@ -41,8 +42,7 @@ test.beforeAll( 'Setup', async ( { baseURL } ) => {

test( 'Partial Refund – Gift card order @giftcard', async ( { page } ) => {
page.on('dialog', dialog => dialog.accept());
await page.goto( '/product/dollar-product' );
await page.locator( '.single_add_to_cart_button' ).click();
await addOneOrMoreProductToCart( page, 'dollar-product' );

await page.goto( '/checkout-old' );
await fillAddressFields( page, false );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test, expect } from '@playwright/test';
import { chromium } from 'playwright';
import { addOneOrMoreProductToCart } from '@woocommerce/e2e-utils-playwright';

import {
createProduct,
Expand Down Expand Up @@ -42,8 +43,7 @@ test.beforeAll( 'Setup', async ( { baseURL } ) => {

test( 'Gift card - Partial payment @giftcard', async ( { page } ) => {
page.on('dialog', dialog => dialog.accept());
await page.goto( '/product/simple-product' );
await page.locator( '.single_add_to_cart_button' ).click();
await addOneOrMoreProductToCart( page, 'simple-product' );

await page.goto( '/checkout-old' );
await fillAddressFields( page, false );
Expand Down
1 change: 0 additions & 1 deletion tests/e2e/specs/c4.product-import.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ test( 'Handle missing products @sync', async ( { page } ) => {
await page.getByTestId( 'sync-settings-field' ).selectOption( { label: 'Square' } );
await page.getByTestId( 'hide-missing-products-field' ).check();
await saveSquareSettings( page );
await page.reload();

await page.goto( '/wp-admin/admin.php?page=wc-settings&tab=square&section=update' );
await page.locator( '#wc-square-sync' ).click();
Expand Down
Loading

0 comments on commit 122ca65

Please sign in to comment.