Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../src/Internal/Admin
File: CustomerEffortScoreTracks.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WooCommerce Customer effort score tracks
[2] Fix | Delete
*
[3] Fix | Delete
* @package WooCommerce\Admin\Features
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
namespace Automattic\WooCommerce\Internal\Admin;
[7] Fix | Delete
[8] Fix | Delete
defined( 'ABSPATH' ) || exit;
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* Triggers customer effort score on several different actions.
[12] Fix | Delete
*/
[13] Fix | Delete
class CustomerEffortScoreTracks {
[14] Fix | Delete
/**
[15] Fix | Delete
* Option name for the CES Tracks queue.
[16] Fix | Delete
*/
[17] Fix | Delete
const CES_TRACKS_QUEUE_OPTION_NAME = 'woocommerce_ces_tracks_queue';
[18] Fix | Delete
[19] Fix | Delete
/**
[20] Fix | Delete
* Option name for the clear CES Tracks queue for page.
[21] Fix | Delete
*/
[22] Fix | Delete
const CLEAR_CES_TRACKS_QUEUE_FOR_PAGE_OPTION_NAME =
[23] Fix | Delete
'woocommerce_clear_ces_tracks_queue_for_page';
[24] Fix | Delete
[25] Fix | Delete
/**
[26] Fix | Delete
* Option name for the set of actions that have been shown.
[27] Fix | Delete
*/
[28] Fix | Delete
const SHOWN_FOR_ACTIONS_OPTION_NAME = 'woocommerce_ces_shown_for_actions';
[29] Fix | Delete
[30] Fix | Delete
/**
[31] Fix | Delete
* Action name for product add/publish.
[32] Fix | Delete
*/
[33] Fix | Delete
const PRODUCT_ADD_PUBLISH_ACTION_NAME = 'product_add_publish';
[34] Fix | Delete
[35] Fix | Delete
/**
[36] Fix | Delete
* Action name for product update.
[37] Fix | Delete
*/
[38] Fix | Delete
const PRODUCT_UPDATE_ACTION_NAME = 'product_update';
[39] Fix | Delete
[40] Fix | Delete
/**
[41] Fix | Delete
* Action name for shop order update.
[42] Fix | Delete
*/
[43] Fix | Delete
const SHOP_ORDER_UPDATE_ACTION_NAME = 'shop_order_update';
[44] Fix | Delete
[45] Fix | Delete
/**
[46] Fix | Delete
* Action name for settings change.
[47] Fix | Delete
*/
[48] Fix | Delete
const SETTINGS_CHANGE_ACTION_NAME = 'settings_change';
[49] Fix | Delete
[50] Fix | Delete
/**
[51] Fix | Delete
* Action name for add product categories.
[52] Fix | Delete
*/
[53] Fix | Delete
const ADD_PRODUCT_CATEGORIES_ACTION_NAME = 'add_product_categories';
[54] Fix | Delete
[55] Fix | Delete
/**
[56] Fix | Delete
* Action name for add product tags.
[57] Fix | Delete
*/
[58] Fix | Delete
const ADD_PRODUCT_TAGS_ACTION_NAME = 'add_product_tags';
[59] Fix | Delete
[60] Fix | Delete
/*
[61] Fix | Delete
* Action name for add product attributes.
[62] Fix | Delete
*/
[63] Fix | Delete
const ADD_PRODUCT_ATTRIBUTES_ACTION_NAME = 'add_product_attributes';
[64] Fix | Delete
[65] Fix | Delete
/**
[66] Fix | Delete
* Action name for import products.
[67] Fix | Delete
*/
[68] Fix | Delete
const IMPORT_PRODUCTS_ACTION_NAME = 'import_products';
[69] Fix | Delete
[70] Fix | Delete
/**
[71] Fix | Delete
* Action name for search.
[72] Fix | Delete
*/
[73] Fix | Delete
const SEARCH_ACTION_NAME = 'ces_search';
[74] Fix | Delete
[75] Fix | Delete
/**
[76] Fix | Delete
* Label for the snackbar that appears when a user submits the survey.
[77] Fix | Delete
*
[78] Fix | Delete
* @var string
[79] Fix | Delete
*/
[80] Fix | Delete
private $onsubmit_label;
[81] Fix | Delete
[82] Fix | Delete
/**
[83] Fix | Delete
* Constructor. Sets up filters to hook into WooCommerce.
[84] Fix | Delete
*/
[85] Fix | Delete
public function __construct() {
[86] Fix | Delete
$this->enable_survey_enqueing_if_tracking_is_enabled();
[87] Fix | Delete
}
[88] Fix | Delete
[89] Fix | Delete
/**
[90] Fix | Delete
* Add actions that require woocommerce_allow_tracking.
[91] Fix | Delete
*/
[92] Fix | Delete
private function enable_survey_enqueing_if_tracking_is_enabled() {
[93] Fix | Delete
// Only hook up the action handlers if in wp-admin.
[94] Fix | Delete
if ( ! is_admin() ) {
[95] Fix | Delete
return;
[96] Fix | Delete
}
[97] Fix | Delete
[98] Fix | Delete
// Do not hook up the action handlers if a mobile device is used.
[99] Fix | Delete
if ( wp_is_mobile() ) {
[100] Fix | Delete
return;
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
// Only enqueue a survey if tracking is allowed.
[104] Fix | Delete
$allow_tracking = 'yes' === get_option( 'woocommerce_allow_tracking', 'no' );
[105] Fix | Delete
if ( ! $allow_tracking ) {
[106] Fix | Delete
return;
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
add_action( 'admin_init', array( $this, 'maybe_clear_ces_tracks_queue' ) );
[110] Fix | Delete
add_action( 'woocommerce_update_options', array( $this, 'run_on_update_options' ), 10, 3 );
[111] Fix | Delete
add_action( 'product_cat_add_form', array( $this, 'add_script_track_product_categories' ), 10, 3 );
[112] Fix | Delete
add_action( 'product_tag_add_form', array( $this, 'add_script_track_product_tags' ), 10, 3 );
[113] Fix | Delete
add_action( 'woocommerce_attribute_added', array( $this, 'run_on_add_product_attributes' ), 10, 3 );
[114] Fix | Delete
add_action( 'load-edit.php', array( $this, 'run_on_load_edit_php' ), 10, 3 );
[115] Fix | Delete
add_action( 'product_page_product_importer', array( $this, 'run_on_product_import' ), 10, 3 );
[116] Fix | Delete
// Only hook up the transition_post_status action handler
[117] Fix | Delete
// if on the edit page.
[118] Fix | Delete
global $pagenow;
[119] Fix | Delete
if ( 'post.php' === $pagenow ) {
[120] Fix | Delete
add_action(
[121] Fix | Delete
'transition_post_status',
[122] Fix | Delete
array(
[123] Fix | Delete
$this,
[124] Fix | Delete
'run_on_transition_post_status',
[125] Fix | Delete
),
[126] Fix | Delete
10,
[127] Fix | Delete
3
[128] Fix | Delete
);
[129] Fix | Delete
}
[130] Fix | Delete
$this->onsubmit_label = __( 'Thank you for your feedback!', 'woocommerce' );
[131] Fix | Delete
}
[132] Fix | Delete
[133] Fix | Delete
/**
[134] Fix | Delete
* Returns a generated script for tracking tags added on edit-tags.php page.
[135] Fix | Delete
* CES survey is triggered via direct access to wc/customer-effort-score store
[136] Fix | Delete
* via wp.data.dispatch method.
[137] Fix | Delete
*
[138] Fix | Delete
* Due to lack of options to directly hook ourselves into the ajax post request
[139] Fix | Delete
* initiated by edit-tags.php page, we infer a successful request by observing
[140] Fix | Delete
* an increase of the number of rows in tags table
[141] Fix | Delete
*
[142] Fix | Delete
* @param string $action Action name for the survey.
[143] Fix | Delete
* @param string $title Title for the snackbar.
[144] Fix | Delete
* @param string $first_question The text for the first question.
[145] Fix | Delete
* @param string $second_question The text for the second question.
[146] Fix | Delete
*
[147] Fix | Delete
* @return string Generated JavaScript to append to page.
[148] Fix | Delete
*/
[149] Fix | Delete
private function get_script_track_edit_php( $action, $title, $first_question, $second_question ) {
[150] Fix | Delete
return sprintf(
[151] Fix | Delete
"(function( $ ) {
[152] Fix | Delete
'use strict';
[153] Fix | Delete
// Hook on submit button and sets a 500ms interval function
[154] Fix | Delete
// to determine successful add tag or otherwise.
[155] Fix | Delete
$('#addtag #submit').on( 'click', function() {
[156] Fix | Delete
const initialCount = $('.tags tbody > tr').length;
[157] Fix | Delete
const interval = setInterval( function() {
[158] Fix | Delete
if ( $('.tags tbody > tr').length > initialCount ) {
[159] Fix | Delete
// New tag detected.
[160] Fix | Delete
clearInterval( interval );
[161] Fix | Delete
wp.data.dispatch('wc/customer-effort-score').addCesSurvey({ action: '%s', title: '%s', firstQuestion: '%s', secondQuestion: '%s', onsubmitLabel: '%s' });
[162] Fix | Delete
} else {
[163] Fix | Delete
// Form is no longer loading, most likely failed.
[164] Fix | Delete
if ( $( '#addtag .submit .spinner.is-active' ).length < 1 ) {
[165] Fix | Delete
clearInterval( interval );
[166] Fix | Delete
}
[167] Fix | Delete
}
[168] Fix | Delete
}, 500 );
[169] Fix | Delete
});
[170] Fix | Delete
})( jQuery );",
[171] Fix | Delete
esc_js( $action ),
[172] Fix | Delete
esc_js( $title ),
[173] Fix | Delete
esc_js( $first_question ),
[174] Fix | Delete
esc_js( $second_question ),
[175] Fix | Delete
esc_js( $this->onsubmit_label )
[176] Fix | Delete
);
[177] Fix | Delete
}
[178] Fix | Delete
[179] Fix | Delete
/**
[180] Fix | Delete
* Get the current published product count.
[181] Fix | Delete
*
[182] Fix | Delete
* @return integer The current published product count.
[183] Fix | Delete
*/
[184] Fix | Delete
private function get_product_count() {
[185] Fix | Delete
$query = new \WC_Product_Query(
[186] Fix | Delete
array(
[187] Fix | Delete
'limit' => 1,
[188] Fix | Delete
'paginate' => true,
[189] Fix | Delete
'return' => 'ids',
[190] Fix | Delete
'status' => array( 'publish' ),
[191] Fix | Delete
)
[192] Fix | Delete
);
[193] Fix | Delete
$products = $query->get_products();
[194] Fix | Delete
$product_count = intval( $products->total );
[195] Fix | Delete
[196] Fix | Delete
return $product_count;
[197] Fix | Delete
}
[198] Fix | Delete
[199] Fix | Delete
/**
[200] Fix | Delete
* Get the current shop order count.
[201] Fix | Delete
*
[202] Fix | Delete
* @return integer The current shop order count.
[203] Fix | Delete
*/
[204] Fix | Delete
private function get_shop_order_count() {
[205] Fix | Delete
$query = new \WC_Order_Query(
[206] Fix | Delete
array(
[207] Fix | Delete
'limit' => 1,
[208] Fix | Delete
'paginate' => true,
[209] Fix | Delete
'return' => 'ids',
[210] Fix | Delete
)
[211] Fix | Delete
);
[212] Fix | Delete
$shop_orders = $query->get_orders();
[213] Fix | Delete
$shop_order_count = intval( $shop_orders->total );
[214] Fix | Delete
[215] Fix | Delete
return $shop_order_count;
[216] Fix | Delete
}
[217] Fix | Delete
[218] Fix | Delete
/**
[219] Fix | Delete
* Return whether the action has already been shown.
[220] Fix | Delete
*
[221] Fix | Delete
* @param string $action The action to check.
[222] Fix | Delete
*
[223] Fix | Delete
* @return bool Whether the action has already been shown.
[224] Fix | Delete
*/
[225] Fix | Delete
private function has_been_shown( $action ) {
[226] Fix | Delete
$shown_for_features = get_option( self::SHOWN_FOR_ACTIONS_OPTION_NAME, array() );
[227] Fix | Delete
$has_been_shown = in_array( $action, $shown_for_features, true );
[228] Fix | Delete
[229] Fix | Delete
return $has_been_shown;
[230] Fix | Delete
}
[231] Fix | Delete
[232] Fix | Delete
/**
[233] Fix | Delete
* Enqueue the item to the CES tracks queue.
[234] Fix | Delete
*
[235] Fix | Delete
* @param array $item The item to enqueue.
[236] Fix | Delete
*/
[237] Fix | Delete
private function enqueue_to_ces_tracks( $item ) {
[238] Fix | Delete
$queue = get_option(
[239] Fix | Delete
self::CES_TRACKS_QUEUE_OPTION_NAME,
[240] Fix | Delete
array()
[241] Fix | Delete
);
[242] Fix | Delete
[243] Fix | Delete
$has_duplicate = array_filter(
[244] Fix | Delete
$queue,
[245] Fix | Delete
function ( $queue_item ) use ( $item ) {
[246] Fix | Delete
return $queue_item['action'] === $item['action'];
[247] Fix | Delete
}
[248] Fix | Delete
);
[249] Fix | Delete
if ( $has_duplicate ) {
[250] Fix | Delete
return;
[251] Fix | Delete
}
[252] Fix | Delete
[253] Fix | Delete
$queue[] = $item;
[254] Fix | Delete
[255] Fix | Delete
update_option(
[256] Fix | Delete
self::CES_TRACKS_QUEUE_OPTION_NAME,
[257] Fix | Delete
$queue
[258] Fix | Delete
);
[259] Fix | Delete
}
[260] Fix | Delete
[261] Fix | Delete
/**
[262] Fix | Delete
* Enqueue the CES survey on using search dynamically.
[263] Fix | Delete
*
[264] Fix | Delete
* @param string $search_area Search area such as "product" or "shop_order".
[265] Fix | Delete
* @param string $page_now Value of window.pagenow.
[266] Fix | Delete
* @param string $admin_page Value of window.adminpage.
[267] Fix | Delete
*/
[268] Fix | Delete
public function enqueue_ces_survey_for_search( $search_area, $page_now, $admin_page ) {
[269] Fix | Delete
if ( $this->has_been_shown( self::SEARCH_ACTION_NAME ) ) {
[270] Fix | Delete
return;
[271] Fix | Delete
}
[272] Fix | Delete
[273] Fix | Delete
$this->enqueue_to_ces_tracks(
[274] Fix | Delete
array(
[275] Fix | Delete
'action' => self::SEARCH_ACTION_NAME,
[276] Fix | Delete
'title' => __(
[277] Fix | Delete
'How easy was it to use search?',
[278] Fix | Delete
'woocommerce'
[279] Fix | Delete
),
[280] Fix | Delete
'firstQuestion' => __(
[281] Fix | Delete
'The search feature in WooCommerce is easy to use.',
[282] Fix | Delete
'woocommerce'
[283] Fix | Delete
),
[284] Fix | Delete
'secondQuestion' => __(
[285] Fix | Delete
'The search\'s functionality meets my needs.',
[286] Fix | Delete
'woocommerce'
[287] Fix | Delete
),
[288] Fix | Delete
'onsubmit_label' => $this->onsubmit_label,
[289] Fix | Delete
'pagenow' => $page_now,
[290] Fix | Delete
'adminpage' => $admin_page,
[291] Fix | Delete
'props' => (object) array(
[292] Fix | Delete
'search_area' => $search_area,
[293] Fix | Delete
),
[294] Fix | Delete
)
[295] Fix | Delete
);
[296] Fix | Delete
}
[297] Fix | Delete
[298] Fix | Delete
/**
[299] Fix | Delete
* Hook into the post status lifecycle, to detect relevant user actions
[300] Fix | Delete
* that we want to survey about.
[301] Fix | Delete
*
[302] Fix | Delete
* @param string $new_status The new status.
[303] Fix | Delete
* @param string $old_status The old status.
[304] Fix | Delete
* @param Post $post The post.
[305] Fix | Delete
*/
[306] Fix | Delete
public function run_on_transition_post_status(
[307] Fix | Delete
$new_status,
[308] Fix | Delete
$old_status,
[309] Fix | Delete
$post
[310] Fix | Delete
) {
[311] Fix | Delete
if ( 'product' === $post->post_type ) {
[312] Fix | Delete
$this->maybe_enqueue_ces_survey_for_product( $new_status, $old_status );
[313] Fix | Delete
} elseif ( 'shop_order' === $post->post_type ) {
[314] Fix | Delete
$this->enqueue_ces_survey_for_edited_shop_order();
[315] Fix | Delete
}
[316] Fix | Delete
}
[317] Fix | Delete
[318] Fix | Delete
/**
[319] Fix | Delete
* Maybe enqueue the CES survey, if product is being added or edited.
[320] Fix | Delete
*
[321] Fix | Delete
* @param string $new_status The new status.
[322] Fix | Delete
* @param string $old_status The old status.
[323] Fix | Delete
*/
[324] Fix | Delete
private function maybe_enqueue_ces_survey_for_product(
[325] Fix | Delete
$new_status,
[326] Fix | Delete
$old_status
[327] Fix | Delete
) {
[328] Fix | Delete
if ( 'publish' !== $new_status ) {
[329] Fix | Delete
return;
[330] Fix | Delete
}
[331] Fix | Delete
[332] Fix | Delete
if ( 'publish' !== $old_status ) {
[333] Fix | Delete
$this->enqueue_ces_survey_for_new_product();
[334] Fix | Delete
} else {
[335] Fix | Delete
$this->enqueue_ces_survey_for_edited_product();
[336] Fix | Delete
}
[337] Fix | Delete
}
[338] Fix | Delete
[339] Fix | Delete
/**
[340] Fix | Delete
* Enqueue the CES survey trigger for a new product.
[341] Fix | Delete
*/
[342] Fix | Delete
private function enqueue_ces_survey_for_new_product() {
[343] Fix | Delete
if ( $this->has_been_shown( self::PRODUCT_ADD_PUBLISH_ACTION_NAME ) ) {
[344] Fix | Delete
return;
[345] Fix | Delete
}
[346] Fix | Delete
[347] Fix | Delete
$this->enqueue_to_ces_tracks(
[348] Fix | Delete
array(
[349] Fix | Delete
'action' => self::PRODUCT_ADD_PUBLISH_ACTION_NAME,
[350] Fix | Delete
'title' => __(
[351] Fix | Delete
'🎉 Congrats on adding your first product!',
[352] Fix | Delete
'woocommerce'
[353] Fix | Delete
),
[354] Fix | Delete
'firstQuestion' => __(
[355] Fix | Delete
'The product creation screen is easy to use.',
[356] Fix | Delete
'woocommerce'
[357] Fix | Delete
),
[358] Fix | Delete
'secondQuestion' => __(
[359] Fix | Delete
'The product creation screen\'s functionality meets my needs.',
[360] Fix | Delete
'woocommerce'
[361] Fix | Delete
),
[362] Fix | Delete
'onsubmit_label' => $this->onsubmit_label,
[363] Fix | Delete
'pagenow' => 'product',
[364] Fix | Delete
'adminpage' => 'post-php',
[365] Fix | Delete
'props' => array(
[366] Fix | Delete
'product_count' => $this->get_product_count(),
[367] Fix | Delete
),
[368] Fix | Delete
)
[369] Fix | Delete
);
[370] Fix | Delete
}
[371] Fix | Delete
[372] Fix | Delete
/**
[373] Fix | Delete
* Enqueue the CES survey trigger for an existing product.
[374] Fix | Delete
*/
[375] Fix | Delete
private function enqueue_ces_survey_for_edited_product() {
[376] Fix | Delete
if ( $this->has_been_shown( self::PRODUCT_UPDATE_ACTION_NAME ) ) {
[377] Fix | Delete
return;
[378] Fix | Delete
}
[379] Fix | Delete
[380] Fix | Delete
$this->enqueue_to_ces_tracks(
[381] Fix | Delete
array(
[382] Fix | Delete
'action' => self::PRODUCT_UPDATE_ACTION_NAME,
[383] Fix | Delete
'title' => __(
[384] Fix | Delete
'How easy was it to edit your product?',
[385] Fix | Delete
'woocommerce'
[386] Fix | Delete
),
[387] Fix | Delete
'firstQuestion' => __(
[388] Fix | Delete
'The product update process is easy to complete.',
[389] Fix | Delete
'woocommerce'
[390] Fix | Delete
),
[391] Fix | Delete
'secondQuestion' => __(
[392] Fix | Delete
'The product update process meets my needs.',
[393] Fix | Delete
'woocommerce'
[394] Fix | Delete
),
[395] Fix | Delete
'onsubmit_label' => $this->onsubmit_label,
[396] Fix | Delete
'pagenow' => 'product',
[397] Fix | Delete
'adminpage' => 'post-php',
[398] Fix | Delete
'props' => array(
[399] Fix | Delete
'product_count' => $this->get_product_count(),
[400] Fix | Delete
),
[401] Fix | Delete
)
[402] Fix | Delete
);
[403] Fix | Delete
}
[404] Fix | Delete
[405] Fix | Delete
/**
[406] Fix | Delete
* Enqueue the CES survey trigger for an existing shop order.
[407] Fix | Delete
*/
[408] Fix | Delete
private function enqueue_ces_survey_for_edited_shop_order() {
[409] Fix | Delete
if ( $this->has_been_shown( self::SHOP_ORDER_UPDATE_ACTION_NAME ) ) {
[410] Fix | Delete
return;
[411] Fix | Delete
}
[412] Fix | Delete
[413] Fix | Delete
$this->enqueue_to_ces_tracks(
[414] Fix | Delete
array(
[415] Fix | Delete
'action' => self::SHOP_ORDER_UPDATE_ACTION_NAME,
[416] Fix | Delete
'title' => __(
[417] Fix | Delete
'How easy was it to update an order?',
[418] Fix | Delete
'woocommerce'
[419] Fix | Delete
),
[420] Fix | Delete
'firstQuestion' => __(
[421] Fix | Delete
'The order details screen is easy to use.',
[422] Fix | Delete
'woocommerce'
[423] Fix | Delete
),
[424] Fix | Delete
'secondQuestion' => __(
[425] Fix | Delete
'The order details screen\'s functionality meets my needs.',
[426] Fix | Delete
'woocommerce'
[427] Fix | Delete
),
[428] Fix | Delete
'onsubmit_label' => $this->onsubmit_label,
[429] Fix | Delete
'pagenow' => 'shop_order',
[430] Fix | Delete
'adminpage' => 'post-php',
[431] Fix | Delete
'props' => array(
[432] Fix | Delete
'order_count' => $this->get_shop_order_count(),
[433] Fix | Delete
),
[434] Fix | Delete
)
[435] Fix | Delete
);
[436] Fix | Delete
}
[437] Fix | Delete
[438] Fix | Delete
/**
[439] Fix | Delete
* Maybe clear the CES tracks queue, executed on every page load. If the
[440] Fix | Delete
* clear option is set it clears the queue. In practice, this executes a
[441] Fix | Delete
* page load after the queued CES tracks are displayed on the client, which
[442] Fix | Delete
* sets the clear option.
[443] Fix | Delete
*/
[444] Fix | Delete
public function maybe_clear_ces_tracks_queue() {
[445] Fix | Delete
$clear_ces_tracks_queue_for_page = get_option(
[446] Fix | Delete
self::CLEAR_CES_TRACKS_QUEUE_FOR_PAGE_OPTION_NAME,
[447] Fix | Delete
false
[448] Fix | Delete
);
[449] Fix | Delete
[450] Fix | Delete
if ( ! $clear_ces_tracks_queue_for_page ) {
[451] Fix | Delete
return;
[452] Fix | Delete
}
[453] Fix | Delete
[454] Fix | Delete
$queue = get_option(
[455] Fix | Delete
self::CES_TRACKS_QUEUE_OPTION_NAME,
[456] Fix | Delete
array()
[457] Fix | Delete
);
[458] Fix | Delete
[459] Fix | Delete
$queue = is_array( $queue ) ? $queue : array();
[460] Fix | Delete
[461] Fix | Delete
$remaining_items = array_filter(
[462] Fix | Delete
$queue,
[463] Fix | Delete
function ( $item ) use ( $clear_ces_tracks_queue_for_page ) {
[464] Fix | Delete
return $clear_ces_tracks_queue_for_page['pagenow'] !== $item['pagenow']
[465] Fix | Delete
|| $clear_ces_tracks_queue_for_page['adminpage'] !== $item['adminpage'];
[466] Fix | Delete
}
[467] Fix | Delete
);
[468] Fix | Delete
[469] Fix | Delete
update_option(
[470] Fix | Delete
self::CES_TRACKS_QUEUE_OPTION_NAME,
[471] Fix | Delete
array_values( $remaining_items )
[472] Fix | Delete
);
[473] Fix | Delete
update_option( self::CLEAR_CES_TRACKS_QUEUE_FOR_PAGE_OPTION_NAME, false );
[474] Fix | Delete
}
[475] Fix | Delete
[476] Fix | Delete
/**
[477] Fix | Delete
* Appends a script to footer to trigger CES on adding product categories.
[478] Fix | Delete
*/
[479] Fix | Delete
public function add_script_track_product_categories() {
[480] Fix | Delete
if ( $this->has_been_shown( self::ADD_PRODUCT_CATEGORIES_ACTION_NAME ) ) {
[481] Fix | Delete
return;
[482] Fix | Delete
}
[483] Fix | Delete
[484] Fix | Delete
wc_enqueue_js(
[485] Fix | Delete
$this->get_script_track_edit_php(
[486] Fix | Delete
self::ADD_PRODUCT_CATEGORIES_ACTION_NAME,
[487] Fix | Delete
__( 'How easy was it to add product category?', 'woocommerce' ),
[488] Fix | Delete
__( 'The product category details screen is easy to use.', 'woocommerce' ),
[489] Fix | Delete
__( "The product category details screen's functionality meets my needs.", 'woocommerce' )
[490] Fix | Delete
)
[491] Fix | Delete
);
[492] Fix | Delete
}
[493] Fix | Delete
[494] Fix | Delete
/**
[495] Fix | Delete
* Appends a script to footer to trigger CES on adding product tags.
[496] Fix | Delete
*/
[497] Fix | Delete
public function add_script_track_product_tags() {
[498] Fix | Delete
if ( $this->has_been_shown( self::ADD_PRODUCT_TAGS_ACTION_NAME ) ) {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function