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
MigrateFromShopify.php
80 lines
| 1 | <?php |
| 2 | /** |
| 3 | * WooCommerce Admin: Migrate from Shopify to WooCommerce. |
| 4 | * |
| 5 | * Adds a note to ask the client if they want to migrate from Shopify to WooCommerce. |
| 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 | * Migrate_From_Shopify. |
| 17 | */ |
| 18 | class MigrateFromShopify { |
| 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-migrate-from-shopify'; |
| 28 | |
| 29 | /** |
| 30 | * Get the note. |
| 31 | * |
| 32 | * @return Note |
| 33 | */ |
| 34 | public static function get_note() { |
| 35 | |
| 36 | // We want to show the note after two days. |
| 37 | $two_days = 2 * DAY_IN_SECONDS; |
| 38 | if ( ! self::is_wc_admin_active_in_date_range( 'week-1', $two_days ) ) { |
| 39 | return; |
| 40 | } |
| 41 | |
| 42 | $onboarding_profile = get_option( 'woocommerce_onboarding_profile', array() ); |
| 43 | if ( |
| 44 | ! isset( $onboarding_profile['setup_client'] ) || |
| 45 | ! isset( $onboarding_profile['selling_venues'] ) || |
| 46 | ! isset( $onboarding_profile['other_platform'] ) |
| 47 | ) { |
| 48 | return; |
| 49 | } |
| 50 | |
| 51 | // Make sure the client is not setup. |
| 52 | if ( $onboarding_profile['setup_client'] ) { |
| 53 | return; |
| 54 | } |
| 55 | |
| 56 | // We will show the notification when the client already is selling and is using Shopify. |
| 57 | if ( |
| 58 | 'other' !== $onboarding_profile['selling_venues'] || |
| 59 | 'shopify' !== $onboarding_profile['other_platform'] |
| 60 | ) { |
| 61 | return; |
| 62 | } |
| 63 | |
| 64 | $note = new Note(); |
| 65 | $note->set_title( __( 'Do you want to migrate from Shopify to WooCommerce?', 'woocommerce' ) ); |
| 66 | $note->set_content( __( 'Changing eCommerce platforms might seem like a big hurdle to overcome, but it is easier than you might think to move your products, customers, and orders to WooCommerce. This article will help you with going through this process.', 'woocommerce' ) ); |
| 67 | $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); |
| 68 | $note->set_name( self::NOTE_NAME ); |
| 69 | $note->set_content_data( (object) array() ); |
| 70 | $note->set_source( 'woocommerce-admin' ); |
| 71 | $note->add_action( |
| 72 | 'migrate-from-shopify', |
| 73 | __( 'Learn more', 'woocommerce' ), |
| 74 | 'https://woocommerce.com/posts/migrate-from-shopify-to-woocommerce/?utm_source=inbox&utm_medium=product', |
| 75 | Note::E_WC_ADMIN_NOTE_ACTIONED |
| 76 | ); |
| 77 | return $note; |
| 78 | } |
| 79 | } |
| 80 |