Skip to content

Instantly share code, notes, and snippets.

@oaratovskyi
Created September 13, 2023 17:37
Show Gist options
  • Save oaratovskyi/05c21f3fcbadb9c471b8d1bede613489 to your computer and use it in GitHub Desktop.
Save oaratovskyi/05c21f3fcbadb9c471b8d1bede613489 to your computer and use it in GitHub Desktop.
Get connect incentive locally
Index: includes/admin/class-wc-payments-admin.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/admin/class-wc-payments-admin.php b/includes/admin/class-wc-payments-admin.php
--- a/includes/admin/class-wc-payments-admin.php (revision 5e89beb5d9b44a171815356a60d2617d58a22542)
+++ b/includes/admin/class-wc-payments-admin.php (date 1694626509838)
@@ -939,9 +939,9 @@
*/
public function add_menu_notification_badge() {
global $menu;
- if ( 'yes' === get_option( 'wcpay_menu_badge_hidden', 'no' ) ) {
- return;
- }
+// if ( 'yes' === get_option( 'wcpay_menu_badge_hidden', 'no' ) ) {
+// return;
+// }
// If plugin activation date is less than 3 days, do not show the badge.
$past_3_days = time() - get_option( 'wcpay_activation_timestamp', 0 ) >= ( 3 * DAY_IN_SECONDS );
Index: includes/class-wc-payments-incentives-service.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/class-wc-payments-incentives-service.php b/includes/class-wc-payments-incentives-service.php
--- a/includes/class-wc-payments-incentives-service.php (revision 5e89beb5d9b44a171815356a60d2617d58a22542)
+++ b/includes/class-wc-payments-incentives-service.php (date 1694626466915)
@@ -119,8 +119,8 @@
// First, get the cache contents, if any.
$incentive_data = $this->database_cache->get( Database_Cache::CONNECT_INCENTIVE_KEY );
// Check if we need to force-refresh the cache contents.
- if ( empty( $incentive_data['context_hash'] ) || ! is_string( $incentive_data['context_hash'] )
- || ! hash_equals( $store_context_hash, $incentive_data['context_hash'] ) ) {
+// if ( empty( $incentive_data['context_hash'] ) || ! is_string( $incentive_data['context_hash'] )
+// || ! hash_equals( $store_context_hash, $incentive_data['context_hash'] ) ) {
// No cache, the hash is missing, or it doesn't match. Force refresh.
$incentive_data = $this->database_cache->get_or_add(
@@ -129,7 +129,7 @@
'is_array',
true
);
- }
+// }
if ( ! $this->is_valid_cached_incentive( $incentive_data ) ) {
return null;
@@ -279,19 +279,10 @@
// WooCommerce active for duration in seconds.
'active_for' => time() - get_option( 'woocommerce_admin_install_timestamp', time() ),
// Whether the store has paid orders in the last 90 days.
- 'has_orders' => ! empty(
- wc_get_orders(
- [
- 'status' => [ 'wc-completed', 'wc-processing' ],
- 'date_created' => '>=' . strtotime( '-90 days' ),
- 'return' => 'ids',
- 'limit' => 1,
- ]
- )
- ),
+ 'has_orders' => true,
// Whether the store has at least one payment gateway enabled.
- 'has_payments' => ! empty( WC()->payment_gateways()->get_available_payment_gateways() ),
- 'has_wcpay' => $this->has_wcpay(),
+ 'has_payments' => true,
+ 'has_wcpay' => false,
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment