Skip to content

feat: add Black Friday integration #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions inc/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function setup_admin_hooks() {

add_action( 'enqueue_block_editor_assets', array( $this, 'add_fse_design_pack_notice' ) );
add_action( 'wp_ajax_jaxon_dismiss_design_pack_notice', array( $this, 'remove_design_pack_notice' ) );
add_filter( 'themeisle_sdk_blackfriday_data', array( $this, 'add_black_friday_data' ) );
}

/**
Expand Down Expand Up @@ -338,4 +339,31 @@ function( $data, $page_slug ) {
);
do_action( 'themeisle_internal_page', JAXON_PRODUCT_SLUG, $screen->id );
}

/**
* Add Black Friday data.
*
* @param array $configs The configuration array for the loaded products.
*
* @return array
*/
public function add_black_friday_data( $configs ) {
$config = $configs['default'];

// translators: %1$s - plugin name, %2$s - HTML tag, %3$s - discount, %4$s - HTML tag, %5$s - company name.
$message_template = __( 'Enhance %1$s with %2$s– up to %3$s OFF in our biggest sale of the year. Limited time only.', 'jaxon' );

$config['dismiss'] = true; // Note: Allow dismiss since it appears on `/wp-admin`.
$config['message'] = sprintf( $message_template, 'Jaxon', 'Otter Blocks Pro', '70%' );
$config['sale_url'] = add_query_arg(
array(
'utm_term' => 'free',
),
tsdk_translate_link( tsdk_utmify( 'https://themeisle.link/otter-bf', 'bfcm', 'jaxon' ) )
);

$configs[ JAXON_PRODUCT_SLUG ] = $config;

return $configs;
}
}
Loading