Skip to content

Commit 14eab34

Browse files
refactor: use the new hook for Black Friday
1 parent 24a3068 commit 14eab34

File tree

5 files changed

+56
-4
lines changed

5 files changed

+56
-4
lines changed

backend/settings-panel.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function __construct() {
9898

9999
add_action( 'admin_enqueue_scripts', array( $this, 'load_scripts' ), 999 );
100100

101-
add_action( 'in_admin_header', array( $this, 'remove_admin_notices' ), 99 );
101+
// add_action( 'in_admin_header', array( $this, 'remove_admin_notices' ), 99 );
102102
// delete_option('ppom_settings_migration_done');
103103
}
104104

classes/plugin.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ function __construct() {
322322
// NOTE: Debug only
323323
// delete_option('ppom_demo_meta_installed');
324324

325-
add_action( 'in_admin_header', 'ppom_hooks_remove_admin_notices', 99 );
325+
// add_action( 'in_admin_header', 'ppom_hooks_remove_admin_notices', 99 );
326326

327327
add_filter( 'woocommerce_order_again_cart_item_data', 'ppom_wc_order_again_compatibility', 10, 3 );
328328
// Show description tooltip.

css/ppom-admin.css

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,14 @@ header.ppom-modal-header {
18631863
text-decoration: none;
18641864
}
18651865

1866-
.ppom-banner:has(.tsdk-banner-cta) {
1867-
margin: 20px 0;
1866+
div.ppom-banner .themeisle-sale {
1867+
margin: 0 0 10px 0;
18681868
}
1869+
1870+
.ppom-banner .themeisle-sale-title {
1871+
font-size: 14px;
1872+
}
1873+
1874+
.ppom-banner .themeisle-sale .themeisle-sale-action a {
1875+
text-decoration: none;
1876+
}

images/black-friday.jpg

-90.1 KB
Binary file not shown.

inc/admin.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,3 +821,47 @@ function ppom_admin_bar_menu() {
821821
);
822822
}
823823
}
824+
825+
/**
826+
* Set Black Friday data.
827+
*
828+
* @param array $configs The configuration array for the loaded products.
829+
*
830+
* @return array
831+
*/
832+
function ppom_add_black_friday_data( $configs ) {
833+
$config = $configs['default'];
834+
835+
// translators: %1$s - HTML tag, %2$s - discount, %3$s - HTML tag, %4$s - product name.
836+
$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' );
837+
$product_label = 'PPOM';
838+
$discount = '70%';
839+
840+
$plan = apply_filters( 'product_ppom_license_plan', 0 );
841+
$license = apply_filters( 'product_ppom_license_key', false );
842+
$is_pro = 0 < $plan;
843+
844+
if ( $is_pro ) {
845+
// translators: %1$s - HTML tag, %2$s - discount, %3$s - HTML tag, %4$s - product name.
846+
$message_template = __( 'Get %1$sup to %2$s off%3$s when you upgrade your %4$s plan or renew early.', 'woocommerce-product-addon' );
847+
$product_label = 'PPOM Pro';
848+
$discount = '30%';
849+
}
850+
851+
$product_label = sprintf( '<strong>%s</strong>', $product_label );
852+
$url_params = array(
853+
'utm_term' => $is_pro ? 'plan-' . $plan : 'free',
854+
'lkey' => ! empty( $license ) ? $license : false,
855+
);
856+
857+
$config['message'] = sprintf( $message_template, '<strong>', $discount, '</strong>', $product_label );
858+
$config['sale_url'] = add_query_arg(
859+
$url_params,
860+
tsdk_translate_link( tsdk_utmify( 'https://themeisle.link/ppom-bf', 'bfcm', 'ppom' ) )
861+
);
862+
863+
$configs[ PPOM_PRODUCT_SLUG ] = $config;
864+
865+
return $configs;
866+
}
867+
add_filter( 'themeisle_sdk_blackfriday_data', 'ppom_add_black_friday_data' );

0 commit comments

Comments
 (0)