Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../src/Internal/Admin/Notes
File: FirstProduct.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WooCommerce Admin: Do you need help with adding your first product?
[2] Fix | Delete
*
[3] Fix | Delete
* Adds a note to ask the client if they need help adding their first product.
[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\Enums\ProductStatus;
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* First_Product.
[16] Fix | Delete
*/
[17] Fix | Delete
class FirstProduct {
[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-first-product';
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
* Get the note.
[30] Fix | Delete
*
[31] Fix | Delete
* @return Note
[32] Fix | Delete
*/
[33] Fix | Delete
public static function get_note() {
[34] Fix | Delete
// We want to show the note after seven days.
[35] Fix | Delete
if ( ! self::is_wc_admin_active_in_date_range( 'week-1-4' ) ) {
[36] Fix | Delete
return;
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
$onboarding_profile = get_option( 'woocommerce_onboarding_profile', array() );
[40] Fix | Delete
[41] Fix | Delete
// Confirm that $onboarding_profile is set.
[42] Fix | Delete
if ( empty( $onboarding_profile ) ) {
[43] Fix | Delete
return;
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
// Make sure that the person who filled out the OBW was not setting up
[47] Fix | Delete
// the store for their customer/client.
[48] Fix | Delete
if (
[49] Fix | Delete
! isset( $onboarding_profile['setup_client'] ) ||
[50] Fix | Delete
$onboarding_profile['setup_client']
[51] Fix | Delete
) {
[52] Fix | Delete
return;
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
// Don't show if there are products.
[56] Fix | Delete
$query = new \WC_Product_Query(
[57] Fix | Delete
array(
[58] Fix | Delete
'limit' => 1,
[59] Fix | Delete
'paginate' => true,
[60] Fix | Delete
'return' => 'ids',
[61] Fix | Delete
'status' => array( ProductStatus::PUBLISH ),
[62] Fix | Delete
)
[63] Fix | Delete
);
[64] Fix | Delete
$products = $query->get_products();
[65] Fix | Delete
$count = $products->total;
[66] Fix | Delete
if ( 0 !== $count ) {
[67] Fix | Delete
return;
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
$note = new Note();
[71] Fix | Delete
$note->set_title( __( 'Do you need help with adding your first product?', 'woocommerce' ) );
[72] Fix | Delete
$note->set_content( __( 'This video tutorial will help you go through the process of adding your first product in WooCommerce.', 'woocommerce' ) );
[73] Fix | Delete
$note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
[74] Fix | Delete
$note->set_name( self::NOTE_NAME );
[75] Fix | Delete
$note->set_content_data( (object) array() );
[76] Fix | Delete
$note->set_source( 'woocommerce-admin' );
[77] Fix | Delete
$note->add_action(
[78] Fix | Delete
'first-product-watch-tutorial',
[79] Fix | Delete
__( 'Watch tutorial', 'woocommerce' ),
[80] Fix | Delete
'https://www.youtube.com/watch?v=sFtXa00Jf_o&list=PLHdG8zvZd0E575Ia8Mu3w1h750YLXNfsC&index=24'
[81] Fix | Delete
);
[82] Fix | Delete
[83] Fix | Delete
return $note;
[84] Fix | Delete
}
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function