Skip to content

Commit ae8ce17

Browse files
refactor: update Black Friday labels (#524)
1 parent 4190c50 commit ae8ce17

3 files changed

Lines changed: 44 additions & 20 deletions

File tree

classes/admin.class.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ public function menu_page_options() {
121121
* @return array
122122
*/
123123
public function upgrade_to_pro_plugin_action( $actions, $plugin_file ) {
124+
if ( apply_filters( 'themeisle_sdk_is_black_friday_sale', false ) ) {
125+
return $actions;
126+
}
127+
124128
if ( apply_filters( 'product_ppom_license_status', '' ) === 'valid' || apply_filters( 'product_ppom_license_status', '' ) === 'active_expired' ) {
125129
return $actions;
126130
}

inc/admin.php

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function ppom_meta_list( $post ) {
132132
$html .= '<th>' . __( 'Group Name', 'woocommerce-product-addon' ) . '</th>';
133133
$html .= '<th>' . __( 'Edit', 'woocommerce-product-addon' ) . '</th>';
134134
$html .= '</tr></thead>';
135-
135+
136136
foreach ( $all_meta as $meta ) {
137137
$html .= '<tr data-ppom-search="' . esc_attr( sanitize_key( $meta->productmeta_name ) ) . '" style="cursor: move;">';
138138

@@ -250,15 +250,15 @@ function ppom_admin_process_product_meta( $post_id ) {
250250

251251

252252
$ppom_meta_selected = isset( $_POST ['ppom_product_meta'] ) ? $_POST ['ppom_product_meta'] : array();
253-
253+
254254
if ( is_numeric( $ppom_meta_selected ) ) {
255255
$ppom_meta_selected = array( $ppom_meta_selected );
256256
} elseif ( ! is_array( $ppom_meta_selected ) ) {
257257
$ppom_meta_selected = array();
258258
}
259-
259+
260260
$ppom_meta_selected = array_map( 'intval', $ppom_meta_selected );
261-
261+
262262
// ppom_pa($ppom_meta_selected); exit;
263263
update_post_meta( $post_id, PPOM_PRODUCT_META_KEY, $ppom_meta_selected );
264264

@@ -428,7 +428,7 @@ function ( $pm ) {
428428
return ! empty( $pm['type'] ) && ! empty( $pm['data_name'] );
429429
}
430430
);
431-
431+
432432
// Updating PPOM Meta with ppom_id in each meta array
433433
ppom_admin_update_ppom_meta_only( $ppom_id, $product_meta );
434434

@@ -913,29 +913,48 @@ function ppom_admin_bar_menu() {
913913
function ppom_add_black_friday_data( $configs ) {
914914
$config = $configs['default'];
915915

916-
// translators: %1$s - HTML tag, %2$s - discount, %3$s - HTML tag, %4$s - product name.
917-
$message_template = __( 'Our biggest sale of the year: %1$sup to %2$s OFF%3$s on %4$s. Don\'t miss this limited-time offer.', 'woocommerce-product-addon' );
918-
$product_label = 'PPOM';
919-
$discount = '70%';
916+
$message = __( 'Conditional fields, file uploads, pricing formulas. Let customers configure products the way they need. Exclusively for existing PPOM users.', 'woocommerce-product-addon' );
917+
$cta_label = __( 'Get PPOM Pro', 'woocommerce-product-addon' );
920918

921919
$plan = apply_filters( 'product_ppom_license_plan', 0 );
922920
$license = apply_filters( 'product_ppom_license_key', false );
923-
$is_pro = 0 < $plan;
921+
$status = apply_filters( 'product_ppom_license_status', false );
922+
$pro_product_slug = defined( 'PPOM_PRO_BASENAME' ) ? PPOM_PRO_BASENAME : '';
923+
924+
$is_pro = 'valid' === $status;
925+
$is_expired = 'expired' === $status || 'active-expired' === $status;
924926

925927
if ( $is_pro ) {
926-
// translators: %1$s - HTML tag, %2$s - discount, %3$s - HTML tag, %4$s - product name.
927-
$message_template = __( 'Get %1$sup to %2$s off%3$s when you upgrade your %4$s plan or renew early.', 'woocommerce-product-addon' );
928-
$product_label = 'PPOM Pro';
929-
$discount = '30%';
928+
// translators: %s is the discount percentage.
929+
$config['plugin_meta_message'] = sprintf( __( 'Black Friday Sale - up to %s off', 'woocommerce-product-addon' ), '30%' );
930+
// translators: %1$s - discount, %2$s - discount.
931+
$message = sprintf( __( 'Upgrade your PPOM Pro plan: %1$s off this week. Already on the plan you need? Renew early and save up to %2$s.', 'woocommerce-product-addon' ), '30%', '20%' );
932+
$cta_label = __( 'See your options', 'woocommerce-product-addon' );
933+
} elseif ( $is_expired ) {
934+
// translators: %s is the discount percentage.
935+
$config['plugin_meta_message'] = sprintf( __( 'Black Friday Sale - %s off', 'woocommerce-product-addon' ), '50%' );
936+
$message = __( 'Your PPOM Pro features are still here, just locked. Renew at a reduced rate this week.', 'woocommerce-product-addon' );
937+
$cta_label = __( 'Reactivate now', 'woocommerce-product-addon' );
938+
} else {
939+
// translators: %s is the discount percentage.
940+
$config['plugin_meta_message'] = sprintf( __( 'Black Friday Sale - %s off', 'woocommerce-product-addon' ), '60%' );
941+
// translators: %s - discount.
942+
$config['title'] = sprintf( __( 'PPOM Pro: %s off this week', 'woocommerce-product-addon' ), '60%' );
930943
}
931-
932-
$product_label = sprintf( '<strong>%s</strong>', $product_label );
944+
933945
$url_params = array(
934946
'utm_term' => $is_pro ? 'plan-' . $plan : 'free',
935947
'lkey' => ! empty( $license ) ? $license : false,
948+
'expired' => $is_expired ? '1' : false,
936949
);
937-
938-
$config['message'] = sprintf( $message_template, '<strong>', $discount, '</strong>', $product_label );
950+
951+
if ( ( $is_pro || $is_expired ) && ! empty( $pro_product_slug ) ) {
952+
$config['plugin_meta_targets'] = array( $pro_product_slug );
953+
}
954+
955+
$config['message'] = $message;
956+
$config['cta_label'] = $cta_label;
957+
939958
$config['sale_url'] = add_query_arg(
940959
$url_params,
941960
tsdk_translate_link( tsdk_utmify( 'https://themeisle.link/ppom-bf', 'bfcm', 'ppom' ) )
@@ -945,4 +964,5 @@ function ppom_add_black_friday_data( $configs ) {
945964

946965
return $configs;
947966
}
967+
948968
add_filter( 'themeisle_sdk_blackfriday_data', 'ppom_add_black_friday_data' );

woocommerce-product-addon.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
define( 'PPOM_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
3232
define( 'PPOM_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
33-
define( 'PPOM_WP_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __DIR__ ) ) );
33+
define( 'PPOM_WP_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
3434
define( 'PPOM_BASENAME', basename( PPOM_WP_PLUGIN_DIR ) );
3535
define( 'PPOM_PRODUCT_SLUG', PPOM_BASENAME );
3636
define( 'PPOM_VERSION', '33.0.18' );
@@ -200,4 +200,4 @@ function () {
200200
);
201201

202202
register_activation_hook( __FILE__, array( 'NM_PersonalizedProduct', 'activate_plugin' ) );
203-
register_deactivation_hook( __FILE__, array( 'NM_PersonalizedProduct', 'deactivate_plugin' ) );
203+
register_deactivation_hook( __FILE__, array( 'NM_PersonalizedProduct', 'deactivate_plugin' ) );

0 commit comments

Comments
 (0)