Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../src/Internal/Admin/Notes
File: MagentoMigration.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WooCommerce Admin note on how to migrate from Magento.
[2] Fix | Delete
*/
[3] Fix | Delete
[4] Fix | Delete
namespace Automattic\WooCommerce\Internal\Admin\Notes;
[5] Fix | Delete
[6] Fix | Delete
use Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingProfile;
[7] Fix | Delete
[8] Fix | Delete
defined( 'ABSPATH' ) || exit;
[9] Fix | Delete
[10] Fix | Delete
use Automattic\WooCommerce\Admin\Features\Onboarding;
[11] Fix | Delete
use Automattic\WooCommerce\Admin\Notes\Note;
[12] Fix | Delete
use Automattic\WooCommerce\Admin\Notes\NoteTraits;
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* MagentoMigration
[16] Fix | Delete
*/
[17] Fix | Delete
class MagentoMigration {
[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-magento-migration';
[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( 'update_option_' . OnboardingProfile::DATA_OPTION, array( __CLASS__, 'possibly_add_note' ) );
[33] Fix | Delete
add_action( 'woocommerce_admin_magento_migration_note', array( __CLASS__, 'save_note' ) );
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
/**
[37] Fix | Delete
* Add the note if it passes predefined conditions.
[38] Fix | Delete
*/
[39] Fix | Delete
public static function possibly_add_note() {
[40] Fix | Delete
$onboarding_profile = get_option( OnboardingProfile::DATA_OPTION, array() );
[41] Fix | Delete
[42] Fix | Delete
if ( empty( $onboarding_profile ) ) {
[43] Fix | Delete
return;
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
if (
[47] Fix | Delete
! isset( $onboarding_profile['other_platform'] ) ||
[48] Fix | Delete
'magento' !== $onboarding_profile['other_platform']
[49] Fix | Delete
) {
[50] Fix | Delete
return;
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
if (
[54] Fix | Delete
! isset( $onboarding_profile['setup_client'] ) ||
[55] Fix | Delete
$onboarding_profile['setup_client']
[56] Fix | Delete
) {
[57] Fix | Delete
return;
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
WC()->queue()->schedule_single( time() + ( 5 * MINUTE_IN_SECONDS ), 'woocommerce_admin_magento_migration_note' );
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
/**
[64] Fix | Delete
* Save the note to the database.
[65] Fix | Delete
*/
[66] Fix | Delete
public static function save_note() {
[67] Fix | Delete
$note = self::get_note();
[68] Fix | Delete
[69] Fix | Delete
if ( self::note_exists() ) {
[70] Fix | Delete
return;
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
$note->save();
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
/**
[77] Fix | Delete
* Get the note.
[78] Fix | Delete
*
[79] Fix | Delete
* @return Note
[80] Fix | Delete
*/
[81] Fix | Delete
public static function get_note() {
[82] Fix | Delete
$note = new Note();
[83] Fix | Delete
[84] Fix | Delete
$note->set_title( __( 'How to Migrate from Magento to WooCommerce', 'woocommerce' ) );
[85] Fix | Delete
$note->set_content( __( 'Changing 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' ) );
[86] Fix | Delete
$note->set_content_data( (object) array() );
[87] Fix | Delete
$note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
[88] Fix | Delete
$note->set_name( self::NOTE_NAME );
[89] Fix | Delete
$note->set_source( 'woocommerce-admin' );
[90] Fix | Delete
$note->add_action(
[91] Fix | Delete
'learn-more',
[92] Fix | Delete
__( 'Learn more', 'woocommerce' ),
[93] Fix | Delete
'https://woocommerce.com/posts/how-migrate-from-magento-to-woocommerce/?utm_source=inbox'
[94] Fix | Delete
);
[95] Fix | Delete
[96] Fix | Delete
return $note;
[97] Fix | Delete
}
[98] Fix | Delete
}
[99] Fix | Delete
[100] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function