CustomizeStoreWithBlocks.php
2 years ago
CustomizingProductCatalog.php
1 year ago
EUVATNumber.php
2 years ago
EditProductsOnTheMove.php
2 years ago
EmailImprovements.php
1 year ago
FirstProduct.php
1 year ago
GivingFeedbackNotes.php
3 years ago
InstallJPAndWCSPlugins.php
4 weeks ago
LaunchChecklist.php
2 years ago
MagentoMigration.php
2 years ago
ManageOrdersOnTheGo.php
2 years ago
MarketingJetpack.php
4 weeks ago
MigrateFromShopify.php
2 years ago
MobileApp.php
2 years ago
NewSalesRecord.php
3 years ago
NoteActionForbiddenException.php
4 weeks ago
OnboardingPayments.php
2 years ago
OnlineClothingStore.php
2 years ago
OrderMilestones.php
2 years ago
PaymentsMoreInfoNeeded.php
5 months ago
PaymentsRemindMeLater.php
5 months ago
PerformanceOnMobile.php
2 years ago
PersonalizeStore.php
3 years ago
RealTimeOrderAlerts.php
2 years ago
ScheduledUpdatesPromotion.php
5 months ago
SellingOnlineCourses.php
2 years ago
TrackingOptIn.php
1 year ago
UnsecuredReportFiles.php
2 years ago
WooCommercePayments.php
2 years ago
WooCommerceSubscriptions.php
2 years ago
WooSubscriptionsNotes.php
1 year ago
OnboardingPayments.php
69 lines
| 1 | <?php |
| 2 | /** |
| 3 | * WooCommerce Admin: Payments reminder note. |
| 4 | * |
| 5 | * Adds a notes to complete the payment methods. |
| 6 | */ |
| 7 | |
| 8 | namespace Automattic\WooCommerce\Internal\Admin\Notes; |
| 9 | |
| 10 | defined( 'ABSPATH' ) || exit; |
| 11 | |
| 12 | use Automattic\WooCommerce\Admin\Notes\Note; |
| 13 | use Automattic\WooCommerce\Admin\Notes\NoteTraits; |
| 14 | |
| 15 | /** |
| 16 | * Onboarding_Payments. |
| 17 | */ |
| 18 | class OnboardingPayments { |
| 19 | /** |
| 20 | * Note traits. |
| 21 | */ |
| 22 | use NoteTraits; |
| 23 | |
| 24 | /** |
| 25 | * Name of the note for use in the database. |
| 26 | */ |
| 27 | const NOTE_NAME = 'wc-admin-onboarding-payments-reminder'; |
| 28 | |
| 29 | /** |
| 30 | * Get the note. |
| 31 | * |
| 32 | * @return Note |
| 33 | */ |
| 34 | public static function get_note() { |
| 35 | // We want to show the note after five days. |
| 36 | if ( ! self::is_wc_admin_active_in_date_range( 'week-1-4', 5 * DAY_IN_SECONDS ) ) { |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | // Check to see if any gateways have been added. |
| 41 | $gateways = WC()->payment_gateways->get_available_payment_gateways(); |
| 42 | $enabled_gateways = array_filter( |
| 43 | $gateways, |
| 44 | function( $gateway ) { |
| 45 | return 'yes' === $gateway->enabled; |
| 46 | } |
| 47 | ); |
| 48 | if ( ! empty( $enabled_gateways ) ) { |
| 49 | return; |
| 50 | } |
| 51 | |
| 52 | $note = new Note(); |
| 53 | $note->set_title( __( 'Start accepting payments on your store!', 'woocommerce' ) ); |
| 54 | $note->set_content( __( 'Take payments with the provider that’s right for you - choose from 100+ payment gateways for WooCommerce.', 'woocommerce' ) ); |
| 55 | $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); |
| 56 | $note->set_name( self::NOTE_NAME ); |
| 57 | $note->set_content_data( (object) array() ); |
| 58 | $note->set_source( 'woocommerce-admin' ); |
| 59 | $note->add_action( |
| 60 | 'view-payment-gateways', |
| 61 | __( 'Learn more', 'woocommerce' ), |
| 62 | 'https://woocommerce.com/product-category/woocommerce-extensions/payment-gateways/?utm_medium=product', |
| 63 | Note::E_WC_ADMIN_NOTE_ACTIONED, |
| 64 | true |
| 65 | ); |
| 66 | return $note; |
| 67 | } |
| 68 | } |
| 69 |