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
OnlineClothingStore.php
99 lines
| 1 | <?php |
| 2 | /** |
| 3 | * WooCommerce Admin: Start your online clothing store. |
| 4 | * |
| 5 | * Adds a note to ask the client if they are considering starting an online |
| 6 | * clothing store. |
| 7 | */ |
| 8 | |
| 9 | namespace Automattic\WooCommerce\Internal\Admin\Notes; |
| 10 | |
| 11 | defined( 'ABSPATH' ) || exit; |
| 12 | |
| 13 | use Automattic\WooCommerce\Admin\Notes\Note; |
| 14 | use Automattic\WooCommerce\Admin\Notes\NoteTraits; |
| 15 | |
| 16 | /** |
| 17 | * Online_Clothing_Store. |
| 18 | */ |
| 19 | class OnlineClothingStore { |
| 20 | /** |
| 21 | * Note traits. |
| 22 | */ |
| 23 | use NoteTraits; |
| 24 | |
| 25 | /** |
| 26 | * Name of the note for use in the database. |
| 27 | */ |
| 28 | const NOTE_NAME = 'wc-admin-online-clothing-store'; |
| 29 | |
| 30 | /** |
| 31 | * Returns whether the industries includes fashion-apparel-accessories. |
| 32 | * |
| 33 | * @param array $industries The industries to search. |
| 34 | * |
| 35 | * @return bool Whether the industries includes fashion-apparel-accessories. |
| 36 | */ |
| 37 | private static function is_in_fashion_industry( $industries ) { |
| 38 | foreach ( $industries as $industry ) { |
| 39 | if ( 'fashion-apparel-accessories' === $industry['slug'] ) { |
| 40 | return true; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | return false; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Get the note. |
| 49 | * |
| 50 | * @return Note |
| 51 | */ |
| 52 | public static function get_note() { |
| 53 | // We want to show the note after two days. |
| 54 | if ( ! self::is_wc_admin_active_in_date_range( 'week-1', 2 * DAY_IN_SECONDS ) ) { |
| 55 | return; |
| 56 | } |
| 57 | |
| 58 | $onboarding_profile = get_option( 'woocommerce_onboarding_profile', array() ); |
| 59 | |
| 60 | // Confirm that $onboarding_profile is set. |
| 61 | if ( empty( $onboarding_profile ) ) { |
| 62 | return; |
| 63 | } |
| 64 | |
| 65 | // Make sure that the person who filled out the OBW was not setting up |
| 66 | // the store for their customer/client. |
| 67 | if ( |
| 68 | ! isset( $onboarding_profile['setup_client'] ) || |
| 69 | $onboarding_profile['setup_client'] |
| 70 | ) { |
| 71 | return; |
| 72 | } |
| 73 | |
| 74 | // We need to show the notification when the industry is |
| 75 | // fashion/apparel/accessories. |
| 76 | if ( ! isset( $onboarding_profile['industry'] ) ) { |
| 77 | return; |
| 78 | } |
| 79 | if ( ! self::is_in_fashion_industry( $onboarding_profile['industry'] ) ) { |
| 80 | return; |
| 81 | } |
| 82 | |
| 83 | $note = new Note(); |
| 84 | $note->set_title( __( 'Start your online clothing store', 'woocommerce' ) ); |
| 85 | $note->set_content( __( 'Starting a fashion website is exciting but it may seem overwhelming as well. In this article, we\'ll walk you through the setup process, teach you to create successful product listings, and show you how to market to your ideal audience.', 'woocommerce' ) ); |
| 86 | $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); |
| 87 | $note->set_name( self::NOTE_NAME ); |
| 88 | $note->set_content_data( (object) array() ); |
| 89 | $note->set_source( 'woocommerce-admin' ); |
| 90 | $note->add_action( |
| 91 | 'online-clothing-store', |
| 92 | __( 'Learn more', 'woocommerce' ), |
| 93 | 'https://woocommerce.com/posts/starting-an-online-clothing-store/?utm_source=inbox&utm_medium=product', |
| 94 | Note::E_WC_ADMIN_NOTE_ACTIONED |
| 95 | ); |
| 96 | return $note; |
| 97 | } |
| 98 | } |
| 99 |