Skip to content

Commit 34c4353

Browse files
mavegafmatticbot
authored andcommitted
Jetpack Sync: Add/sync woo remove order items (#33748)
* Add action 'woocommerce_remove_order_item_ids' to send sync event when order items are removed * Adding class WC_Order to order Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8885013513 Upstream-Ref: Automattic/jetpack@f881188
1 parent e505090 commit 34c4353

File tree

9 files changed

+148
-121
lines changed

9 files changed

+148
-121
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"automattic/jetpack-my-jetpack": "^4.22.4-alpha",
2828
"automattic/jetpack-plugin-deactivation": "^0.2.1",
2929
"automattic/jetpack-plugins-installer": "^0.3.4",
30-
"automattic/jetpack-sync": "^2.14.1-alpha",
30+
"automattic/jetpack-sync": "^2.15.0-alpha",
3131
"automattic/jetpack-wp-js-data-sync": "^0.4.5-alpha",
3232
"tedivm/jshrink": "1.4.0",
3333
"tubalmartin/cssmin": "^4.1"

jetpack_vendor/automattic/jetpack-sync/CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [2.14.1-alpha] - unreleased
8+
## [2.15.0-alpha] - unreleased
99

1010
This is an alpha version! The changes listed here are not final.
1111

12+
### Added
13+
- Add Woocommerce event remove_order_items to Jetpack Sync
14+
1215
### Fixed
1316
- Jetpack Sync: Prevent enqueueing invalid Woo HPOS order data
1417

@@ -1126,7 +1129,7 @@ This is an alpha version! The changes listed here are not final.
11261129

11271130
- Packages: Move sync to a classmapped package
11281131

1129-
[2.14.1-alpha]: https://github.com/Automattic/jetpack-sync/compare/v2.14.0...v2.14.1-alpha
1132+
[2.15.0-alpha]: https://github.com/Automattic/jetpack-sync/compare/v2.14.0...v2.15.0-alpha
11301133
[2.14.0]: https://github.com/Automattic/jetpack-sync/compare/v2.13.1...v2.14.0
11311134
[2.13.1]: https://github.com/Automattic/jetpack-sync/compare/v2.13.0...v2.13.1
11321135
[2.13.0]: https://github.com/Automattic/jetpack-sync/compare/v2.12.0...v2.13.0

jetpack_vendor/automattic/jetpack-sync/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"link-template": "https://github.com/Automattic/jetpack-sync/compare/v${old}...v${new}"
5050
},
5151
"branch-alias": {
52-
"dev-trunk": "2.14.x-dev"
52+
"dev-trunk": "2.15.x-dev"
5353
}
5454
},
5555
"config": {

jetpack_vendor/automattic/jetpack-sync/src/class-package-version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
class Package_Version {
1414

15-
const PACKAGE_VERSION = '2.14.1-alpha';
15+
const PACKAGE_VERSION = '2.15.0-alpha';
1616

1717
const PACKAGE_SLUG = 'sync';
1818

jetpack_vendor/automattic/jetpack-sync/src/modules/class-woocommerce.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Automattic\Jetpack\Sync\Modules;
99

10+
use WC_Order;
1011
use WP_Error;
1112

1213
/**
@@ -93,6 +94,9 @@ public function __construct() {
9394

9495
// Blacklist Action Scheduler comment types.
9596
add_filter( 'jetpack_sync_prevent_sending_comment_data', array( $this, 'filter_action_scheduler_comments' ), 10, 2 );
97+
98+
// Preprocess action to be sent by Jetpack sync.
99+
add_action( 'woocommerce_remove_order_items', array( $this, 'action_woocommerce_remove_order_items' ), 10, 2 );
96100
}
97101

98102
/**
@@ -128,6 +132,7 @@ public function init_listeners( $callable ) {
128132
add_action( 'woocommerce_new_order_item', $callable, 10, 4 );
129133
add_action( 'woocommerce_update_order_item', $callable, 10, 4 );
130134
add_action( 'woocommerce_delete_order_item', $callable, 10, 1 );
135+
add_action( 'woocommerce_remove_order_item_ids', $callable, 10, 1 );
131136
$this->init_listeners_for_meta_type( 'order_item', $callable );
132137

133138
// Payment tokens.
@@ -197,6 +202,25 @@ public function filter_order_item( $args ) {
197202
return $args;
198203
}
199204

205+
/**
206+
* Retrieve the order item ids to be removed and send them as one action
207+
*
208+
* @param WC_Order $order The order argument.
209+
* @param string $type Order item type.
210+
*/
211+
public function action_woocommerce_remove_order_items( WC_Order $order, $type ) {
212+
if ( $type ) {
213+
$order_items = $order->get_items( $type );
214+
} else {
215+
$order_items = $order->get_items();
216+
}
217+
$order_item_ids = array_keys( $order_items );
218+
219+
if ( $order_item_ids ) {
220+
do_action( 'woocommerce_remove_order_item_ids', $order_item_ids );
221+
}
222+
}
223+
200224
/**
201225
* Expand order item IDs to order items and their meta.
202226
*

jetpack_vendor/i18n-map.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
),
6767
'jetpack-sync' => array(
6868
'path' => 'jetpack_vendor/automattic/jetpack-sync',
69-
'ver' => '2.14.1-alpha1714405190',
69+
'ver' => '2.15.0-alpha1714422600',
7070
),
7171
'jetpack-wp-js-data-sync' => array(
7272
'path' => 'jetpack_vendor/automattic/jetpack-wp-js-data-sync',

vendor/composer/installed.json

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dist": {
88
"type": "path",
99
"url": "/tmp/jetpack-build/Automattic/jetpack-a8c-mc-stats",
10-
"reference": "7bd98def74b10166c0cac193a9004b383875bd1f"
10+
"reference": "049768f801b55a337e19a1469a0c352f31cd140a"
1111
},
1212
"require": {
1313
"php": ">=7.0"
@@ -60,7 +60,7 @@
6060
"dist": {
6161
"type": "path",
6262
"url": "/tmp/jetpack-build/Automattic/jetpack-admin-ui",
63-
"reference": "01f2f26ab2537ff37513312ad735a4c307d65fdd"
63+
"reference": "36c42b9a0b987f7f1d75c627ccdad17df1ad4917"
6464
},
6565
"require": {
6666
"php": ">=7.0"
@@ -125,7 +125,7 @@
125125
"dist": {
126126
"type": "path",
127127
"url": "/tmp/jetpack-build/Automattic/jetpack-assets",
128-
"reference": "d3856baa5c89ae0bb0d3b57adb2fbda42f203136"
128+
"reference": "8949a0ef8c79d24b6fbc57ee4bda6ecd284dfe67"
129129
},
130130
"require": {
131131
"automattic/jetpack-constants": "^2.0.2-alpha",
@@ -194,7 +194,7 @@
194194
"dist": {
195195
"type": "path",
196196
"url": "/tmp/jetpack-build/Automattic/jetpack-autoloader",
197-
"reference": "0923be5c5a53f4d833141c6c36e5322c7e48843f"
197+
"reference": "ea01a2c0ad4db259cfe0cd101ec002a2a8e73f01"
198198
},
199199
"require": {
200200
"composer-plugin-api": "^1.1 || ^2.0",
@@ -261,7 +261,7 @@
261261
"dist": {
262262
"type": "path",
263263
"url": "/tmp/jetpack-build/Automattic/jetpack-boost-core",
264-
"reference": "f811c1f03705615199648a55aea1d3d18a052d15"
264+
"reference": "a831e6a47a488b58a490952216b3f3bae4c6b4fb"
265265
},
266266
"require": {
267267
"php": ">=7.0"
@@ -328,7 +328,7 @@
328328
"dist": {
329329
"type": "path",
330330
"url": "/tmp/jetpack-build/Automattic/jetpack-boost-speed-score",
331-
"reference": "f4be122b010ff17a78543ed808b64e2bd2681f94"
331+
"reference": "47c9f820d352bd52731bf9dc18328f21d1b8e420"
332332
},
333333
"require": {
334334
"automattic/jetpack-boost-core": "^0.2.6",
@@ -404,7 +404,7 @@
404404
"dist": {
405405
"type": "path",
406406
"url": "/tmp/jetpack-build/Automattic/jetpack-composer-plugin",
407-
"reference": "a87f8ad1797a1dca2e14f6437a96e8a77b5c54c0"
407+
"reference": "65a05291e6349f48f3d15dcf640d27b2fcc3b7f6"
408408
},
409409
"require": {
410410
"composer-plugin-api": "^2.1.0",
@@ -464,7 +464,7 @@
464464
"dist": {
465465
"type": "path",
466466
"url": "/tmp/jetpack-build/Automattic/jetpack-config",
467-
"reference": "e7664869a16e5e3448c14831c02b713cd9092425"
467+
"reference": "bc235f27e31d1656df95be1ecec5db03a1727ff3"
468468
},
469469
"require": {
470470
"php": ">=7.0"
@@ -509,7 +509,7 @@
509509
"dist": {
510510
"type": "path",
511511
"url": "/tmp/jetpack-build/Automattic/jetpack-connection",
512-
"reference": "58513d5c26b84ed98e3806e478a6c518d0abed12"
512+
"reference": "eea006f8f23b9fedacb6df37e8beee08e78041a5"
513513
},
514514
"require": {
515515
"automattic/jetpack-a8c-mc-stats": "^2.0.1",
@@ -589,7 +589,7 @@
589589
"dist": {
590590
"type": "path",
591591
"url": "/tmp/jetpack-build/Automattic/jetpack-constants",
592-
"reference": "445f63cab78dacb9178c2dcfa4f4b8655e15f4aa"
592+
"reference": "540ecd9da75e4bdd6cc46be3817ae0a02c559f86"
593593
},
594594
"require": {
595595
"php": ">=7.0"
@@ -643,7 +643,7 @@
643643
"dist": {
644644
"type": "path",
645645
"url": "/tmp/jetpack-build/Automattic/jetpack-device-detection",
646-
"reference": "2205fc7c94959a4267018eefcaadb993964d4d3b"
646+
"reference": "b476de592aaebe44a75d37cb756717c571e0eb5d"
647647
},
648648
"require": {
649649
"php": ">=7.0"
@@ -696,7 +696,7 @@
696696
"dist": {
697697
"type": "path",
698698
"url": "/tmp/jetpack-build/Automattic/jetpack-identity-crisis",
699-
"reference": "d95342883cb5bcc878dcc6a56699a361492f431c"
699+
"reference": "277442abfd82282f8cc877c2e30589c4237b703c"
700700
},
701701
"require": {
702702
"automattic/jetpack-assets": "^2.1.8",
@@ -775,7 +775,7 @@
775775
"dist": {
776776
"type": "path",
777777
"url": "/tmp/jetpack-build/Automattic/jetpack-image-cdn",
778-
"reference": "4689e88b4abc27186b305d98b459b65109c221d4"
778+
"reference": "c8f6ce2f874793af2224e9334412dfd279db78d1"
779779
},
780780
"require": {
781781
"automattic/jetpack-assets": "^2.1.8",
@@ -841,7 +841,7 @@
841841
"dist": {
842842
"type": "path",
843843
"url": "/tmp/jetpack-build/Automattic/jetpack-ip",
844-
"reference": "4254b134cfabfc9a99576df115bd62f9c833805b"
844+
"reference": "95b28e5eb2e7d72148eb9a2cf5a183e076ff17bb"
845845
},
846846
"require": {
847847
"php": ">=7.0"
@@ -899,7 +899,7 @@
899899
"dist": {
900900
"type": "path",
901901
"url": "/tmp/jetpack-build/Automattic/jetpack-jitm",
902-
"reference": "dc0d9ec41467acb7d21ad851145e59e7aa3bd490"
902+
"reference": "0b08b63f004700ab72c9d614f0b89043a97af242"
903903
},
904904
"require": {
905905
"automattic/jetpack-a8c-mc-stats": "^2.0.1",
@@ -974,7 +974,7 @@
974974
"dist": {
975975
"type": "path",
976976
"url": "/tmp/jetpack-build/Automattic/jetpack-licensing",
977-
"reference": "cb64555f88a1794138704e160caf5b4f87a856a9"
977+
"reference": "505ebed672d3eec0a14ddd5d406713250d0ea749"
978978
},
979979
"require": {
980980
"automattic/jetpack-connection": "^2.7.5-alpha",
@@ -1036,7 +1036,7 @@
10361036
"dist": {
10371037
"type": "path",
10381038
"url": "/tmp/jetpack-build/Automattic/jetpack-logo",
1039-
"reference": "3a222396073a82a66c4756bcf46613938412fdc0"
1039+
"reference": "3ecb253cc668b653b46a405df49ea32b956480b3"
10401040
},
10411041
"require": {
10421042
"php": ">=7.0"
@@ -1089,7 +1089,7 @@
10891089
"dist": {
10901090
"type": "path",
10911091
"url": "/tmp/jetpack-build/Automattic/jetpack-my-jetpack",
1092-
"reference": "ec28a73726559b9ad8b97ba7f4bbc3955682fc7f"
1092+
"reference": "e66ecdbc6f0eb1738a29b90c92e732a3186062e6"
10931093
},
10941094
"require": {
10951095
"automattic/jetpack-admin-ui": "^0.4.2",
@@ -1183,7 +1183,7 @@
11831183
"dist": {
11841184
"type": "path",
11851185
"url": "/tmp/jetpack-build/Automattic/jetpack-password-checker",
1186-
"reference": "0b9368a8375082111ae22dba94453c08fbc2bfa3"
1186+
"reference": "15a631142880f136401773b180f8f6b949cbcc1d"
11871187
},
11881188
"require": {
11891189
"php": ">=7.0"
@@ -1244,7 +1244,7 @@
12441244
"dist": {
12451245
"type": "path",
12461246
"url": "/tmp/jetpack-build/Automattic/jetpack-plans",
1247-
"reference": "d0a9fcbbf58d83662e0a2310592a5ad87c5265a0"
1247+
"reference": "627b9f3868930f50a7655c4efdc83422124d89b9"
12481248
},
12491249
"require": {
12501250
"automattic/jetpack-connection": "^2.7.5-alpha",
@@ -1312,7 +1312,7 @@
13121312
"dist": {
13131313
"type": "path",
13141314
"url": "/tmp/jetpack-build/Automattic/jetpack-plugin-deactivation",
1315-
"reference": "b0059fb50cc990610501013432a5a740088e44d8"
1315+
"reference": "16d607a870545cb48c9d4f06d08ae3e94214f942"
13161316
},
13171317
"require": {
13181318
"automattic/jetpack-assets": "^2.1.8",
@@ -1380,7 +1380,7 @@
13801380
"dist": {
13811381
"type": "path",
13821382
"url": "/tmp/jetpack-build/Automattic/jetpack-plugins-installer",
1383-
"reference": "0b790aea681239518d1e3cf719d8b6065d5ee85c"
1383+
"reference": "e5e3d04be6f827befe977229266ab686c18f6f49"
13841384
},
13851385
"require": {
13861386
"automattic/jetpack-a8c-mc-stats": "^2.0.1",
@@ -1435,7 +1435,7 @@
14351435
"dist": {
14361436
"type": "path",
14371437
"url": "/tmp/jetpack-build/Automattic/jetpack-redirect",
1438-
"reference": "121ca518bdfa84948ac4d2bd6e4b67686b6144f7"
1438+
"reference": "2247081357794c0bac6773ceec181540d4f7957e"
14391439
},
14401440
"require": {
14411441
"automattic/jetpack-status": "^3.0.1-alpha",
@@ -1490,7 +1490,7 @@
14901490
"dist": {
14911491
"type": "path",
14921492
"url": "/tmp/jetpack-build/Automattic/jetpack-roles",
1493-
"reference": "158225dca54f1716a72557ae6c1ce1a768e8db11"
1493+
"reference": "f1f6554dbc6ee6d82e0c0d80d34f5b412085ff32"
14941494
},
14951495
"require": {
14961496
"php": ">=7.0"
@@ -1544,7 +1544,7 @@
15441544
"dist": {
15451545
"type": "path",
15461546
"url": "/tmp/jetpack-build/Automattic/jetpack-status",
1547-
"reference": "7d02caaad9262e056773b087e3482deaef030680"
1547+
"reference": "c28510a7ba021ba728ae6776d658ea2555e52756"
15481548
},
15491549
"require": {
15501550
"automattic/jetpack-constants": "^2.0.2-alpha",
@@ -1595,12 +1595,12 @@
15951595
},
15961596
{
15971597
"name": "automattic/jetpack-sync",
1598-
"version": "2.14.1-alpha.1714405190",
1599-
"version_normalized": "2.14.1.0-alpha1714405190",
1598+
"version": "2.15.0-alpha.1714422600",
1599+
"version_normalized": "2.15.0.0-alpha1714422600",
16001600
"dist": {
16011601
"type": "path",
16021602
"url": "/tmp/jetpack-build/Automattic/jetpack-sync",
1603-
"reference": "5c6baf8379d0130f7e65f92c66cce9d953ddd5bd"
1603+
"reference": "8d8d34c10b5d7e41be0e4541855aa3b33362613a"
16041604
},
16051605
"require": {
16061606
"automattic/jetpack-connection": "^2.7.5-alpha",
@@ -1632,7 +1632,7 @@
16321632
"link-template": "https://github.com/Automattic/jetpack-sync/compare/v${old}...v${new}"
16331633
},
16341634
"branch-alias": {
1635-
"dev-trunk": "2.14.x-dev"
1635+
"dev-trunk": "2.15.x-dev"
16361636
}
16371637
},
16381638
"installation-source": "dist",
@@ -1671,7 +1671,7 @@
16711671
"dist": {
16721672
"type": "path",
16731673
"url": "/tmp/jetpack-build/Automattic/jetpack-wp-js-data-sync",
1674-
"reference": "ad0e5b38f217f1f768e8f1fefdc04b200c9ecd47"
1674+
"reference": "3ad53910a7673a5a3f5d9027d5c6ee8fd98793ef"
16751675
},
16761676
"require": {
16771677
"php": ">=7.0"

0 commit comments

Comments
 (0)