Skip to content

Commit 387b1ba

Browse files
Merge pull request #94 from Codeinwp/feat/black-friday
feat: add Black Friday integration
2 parents 92bdfd7 + bc6dccd commit 387b1ba

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

inc/Admin.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function setup_admin_hooks() {
3737

3838
add_action( 'enqueue_block_editor_assets', array( $this, 'add_fse_design_pack_notice' ) );
3939
add_action( 'wp_ajax_riverbank_dismiss_design_pack_notice', array( $this, 'remove_design_pack_notice' ) );
40+
add_filter( 'themeisle_sdk_blackfriday_data', array( $this, 'add_black_friday_data' ) );
4041
}
4142
/**
4243
* Render design pack notice.
@@ -339,4 +340,31 @@ function( $data, $page_slug ) {
339340
);
340341
do_action( 'themeisle_internal_page', RIVERBANK_PRODUCT_SLUG, $screen->id );
341342
}
343+
344+
/**
345+
* Add Black Friday data.
346+
*
347+
* @param array $configs The configuration array for the loaded products.
348+
*
349+
* @return array
350+
*/
351+
public function add_black_friday_data( $configs ) {
352+
$config = $configs['default'];
353+
354+
// translators: %1$s - plugin name, %2$s - HTML tag, %3$s - discount.
355+
$message_template = __( 'Enhance %1$s with %2$s– up to %3$s OFF in our biggest sale of the year. Limited time only.', 'riverbank' );
356+
357+
$config['dismiss'] = true; // Note: Allow dismiss since it appears on `/wp-admin`.
358+
$config['message'] = sprintf( $message_template, 'Riverbank', 'Otter Blocks Pro', '70%' );
359+
$config['sale_url'] = add_query_arg(
360+
array(
361+
'utm_term' => 'free',
362+
),
363+
tsdk_translate_link( tsdk_utmify( 'https://themeisle.link/otter-bf', 'bfcm', 'riverbank' ) )
364+
);
365+
366+
$configs[ RIVERBANK_PRODUCT_SLUG ] = $config;
367+
368+
return $configs;
369+
}
342370
}

0 commit comments

Comments
 (0)