Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../src/Internal/Admin/Notes
File: SellingOnlineCourses.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WooCommerce Admin: Selling Online Courses note
[2] Fix | Delete
*
[3] Fix | Delete
* Adds a note to encourage selling online courses.
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
namespace Automattic\WooCommerce\Internal\Admin\Notes;
[7] Fix | Delete
[8] Fix | Delete
defined( 'ABSPATH' ) || exit;
[9] Fix | Delete
[10] Fix | Delete
use Automattic\WooCommerce\Admin\Notes\Note;
[11] Fix | Delete
use Automattic\WooCommerce\Admin\Notes\NoteTraits;
[12] Fix | Delete
use Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingProfile;
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* Selling_Online_Courses
[16] Fix | Delete
*/
[17] Fix | Delete
class SellingOnlineCourses {
[18] Fix | Delete
/**
[19] Fix | Delete
* Note traits.
[20] Fix | Delete
*/
[21] Fix | Delete
use NoteTraits;
[22] Fix | Delete
[23] Fix | Delete
/**
[24] Fix | Delete
* Name of the note for use in the database.
[25] Fix | Delete
*/
[26] Fix | Delete
const NOTE_NAME = 'wc-admin-selling-online-courses';
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
* Attach hooks.
[30] Fix | Delete
*/
[31] Fix | Delete
public function __construct() {
[32] Fix | Delete
add_action(
[33] Fix | Delete
'update_option_' . OnboardingProfile::DATA_OPTION,
[34] Fix | Delete
array( $this, 'check_onboarding_profile' ),
[35] Fix | Delete
10,
[36] Fix | Delete
3
[37] Fix | Delete
);
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
/**
[41] Fix | Delete
* Check to see if the profiler options match before possibly adding note.
[42] Fix | Delete
*
[43] Fix | Delete
* @param object $old_value The old option value.
[44] Fix | Delete
* @param object $value The new option value.
[45] Fix | Delete
* @param string $option The name of the option.
[46] Fix | Delete
*/
[47] Fix | Delete
public static function check_onboarding_profile( $old_value, $value, $option ) {
[48] Fix | Delete
// Skip adding if this store is in the education/learning industry.
[49] Fix | Delete
if ( ! isset( $value['industry'] ) ) {
[50] Fix | Delete
return;
[51] Fix | Delete
}
[52] Fix | Delete
$industry_slugs = array_column( $value['industry'], 'slug' );
[53] Fix | Delete
if ( ! in_array( 'education-and-learning', $industry_slugs, true ) ) {
[54] Fix | Delete
return;
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
self::possibly_add_note();
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
/**
[61] Fix | Delete
* Get the note.
[62] Fix | Delete
*
[63] Fix | Delete
* @return Note
[64] Fix | Delete
*/
[65] Fix | Delete
public static function get_note() {
[66] Fix | Delete
$note = new Note();
[67] Fix | Delete
[68] Fix | Delete
$note->set_title( __( 'Do you want to sell online courses?', 'woocommerce' ) );
[69] Fix | Delete
$note->set_content( __( 'Online courses are a great solution for any business that can teach a new skill. Since courses don’t require physical product development or shipping, they’re affordable, fast to create, and can generate passive income for years to come. In this article, we provide you more information about selling courses using WooCommerce.', 'woocommerce' ) );
[70] Fix | Delete
$note->set_content_data( (object) array() );
[71] Fix | Delete
$note->set_type( Note::E_WC_ADMIN_NOTE_MARKETING );
[72] Fix | Delete
$note->set_name( self::NOTE_NAME );
[73] Fix | Delete
$note->set_source( 'woocommerce-admin' );
[74] Fix | Delete
$note->add_action(
[75] Fix | Delete
'learn-more',
[76] Fix | Delete
__( 'Learn more', 'woocommerce' ),
[77] Fix | Delete
'https://woocommerce.com/posts/how-to-sell-online-courses-wordpress/?utm_source=inbox&utm_medium=product',
[78] Fix | Delete
Note::E_WC_ADMIN_NOTE_ACTIONED
[79] Fix | Delete
);
[80] Fix | Delete
[81] Fix | Delete
return $note;
[82] Fix | Delete
}
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function