WooCommerce integration UI - #855
Conversation
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## dev #855 +/- ##
============================================
- Coverage 28.55% 28.42% -0.13%
- Complexity 6212 6254 +42
============================================
Files 286 286
Lines 25662 25774 +112
============================================
Hits 7327 7327
- Misses 18335 18447 +112 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Updates the WooCommerce integration to present blocked (spam) orders in an admin list-table UI closer to WooCommerce’s native orders screen, while also adjusting how blocked checkouts are handled and enabling blocked-order storage by default.
Changes:
- Reworks the spam orders list table: new “Order / Date / Status / Total” columns, views (“All / On hold / Spam”), and sortable columns (including total).
- Adjusts WooCommerce checkout blocking behavior to store blocked orders, clear cart, and redirect in both classic and Store API flows.
- Adds admin CSS to style the spam-orders table like WooCommerce’s orders list and flips the default setting to store blocked orders.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/Cleantalk/ApbctWP/WcSpamOrdersListTable.php | Updates the spam orders WP_List_Table UI (columns, views, sorting, total/status rendering). |
| lib/Cleantalk/ApbctWP/State.php | Enables storing blocked WooCommerce orders by default. |
| lib/Cleantalk/Antispam/IntegrationsByClass/Woocommerce.php | Changes blocked-checkout handling (storage, cart emptying, redirect responses). |
| css/src/cleantalk-admin.css | Adds styles for the new WooCommerce-like spam orders table layout. |
| css/cleantalk-admin.min.css | Minified CSS update reflecting the new admin styles. |
Files not reviewed (1)
- css/cleantalk-admin.min.css: Generated file
Suppressed comments (1)
lib/Cleantalk/Antispam/IntegrationsByClass/Woocommerce.php:259
- Same issue as above: this early return disables spam checking for Store API checkouts when
data__wc_store_blocked_ordersis off. It should only skip persistence of blocked orders, not the spam check itself.
if ( ! $apbct->settings['data__wc_store_blocked_orders'] ) {
// The checkout is left to WooCommerce as is: no check, no blocked order to store.
return;
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if ( ! $apbct->settings['data__wc_store_blocked_orders'] ) { | ||
| // The checkout is left to WooCommerce as is: no check, no blocked order to store. | ||
| return; | ||
| } |
| $order_column = sprintf( | ||
| '%1$s %2$s', | ||
| $this->renderOrderColumn($wc_spam_order->id, $wc_spam_order->customer_details), | ||
| $this->row_actions($actions) | ||
| ); | ||
|
|
||
| $order_details_column = $this->renderOrderDetailsColumn($wc_spam_order->order_details); | ||
| $customer_details_column = $this->renderCustomerDetailsColumn($wc_spam_order->customer_details); | ||
| $order_date_column = $this->renderOrderDateColumn($wc_spam_order->order_date); | ||
| $order_date_column = $this->renderOrderDateColumn($wc_spam_order->order_date); | ||
| $status_column = $this->renderStatusColumn(); | ||
| $total_column = $this->renderTotalColumn($wc_spam_order->order_details); |
| private function handleBlockedOrder() | ||
| { | ||
| $this->storeBlockedOrder(); | ||
|
|
||
| if ( function_exists('wc') && ! is_null(wc()->cart) ) { | ||
| wc()->cart->empty_cart(); | ||
| } | ||
| } |
| private function getBlockedOrderRedirectUrl() | ||
| { | ||
| return wc_get_endpoint_url('order-received', '', wc_get_checkout_url()); | ||
| } |
| // Fresh orders are shown as "5 minutes ago", the older ones as a date. Same as WooCommerce does. | ||
| $diff = time() - $timestamp; | ||
| if ( $diff >= 0 && $diff < DAY_IN_SECONDS ) { | ||
| /* translators: %s: human-readable time difference */ | ||
| $show_date = sprintf(__('%s ago', 'cleantalk-spam-protect'), human_time_diff($timestamp, time())); | ||
| } else { | ||
| $show_date = date_i18n('M j, Y', $timestamp); // Feb 15, 2023 | ||
| } |
https://app.doboard.com/1/task/54749