Skip to content

refactor: use the new hooks for Black Friday #1069

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 17 commits into
base: development
Choose a base branch
from

Conversation

Soare-Robert-Daniel
Copy link
Contributor

@Soare-Robert-Daniel Soare-Robert-Daniel commented May 7, 2025

Summary

Use the Black Friday hooks from https://github.com/Codeinwp/themeisle-sdk-main/pull/295

Will affect visual aspect of the product

YES

Screenshots

CleanShot 2025-05-12 at 16 14 20@2x
CleanShot 2025-05-12 at 16 14 38@2x

CleanShot 2025-05-12 at 16 14 50@2x
CleanShot 2025-05-12 at 16 26 57@2x
CleanShot 2025-05-12 at 16 27 38@2x

CleanShot 2025-05-15 at 14 30 42@2x

Test instructions

You can use this hook to alternate it:

add_filter(
	'themeisle_sdk_current_date',
	function() {
		return new DateTime( '2025-11-26' );
	}
);

Check before Pull Request is ready:

Closes https://github.com/Codeinwp/ideas/issues/59

@Soare-Robert-Daniel Soare-Robert-Daniel self-assigned this May 12, 2025
@Soare-Robert-Daniel Soare-Robert-Daniel added the pr-checklist-skip Allow this Pull Request to skip checklist. label May 12, 2025
@Soare-Robert-Daniel Soare-Robert-Daniel marked this pull request as ready for review May 12, 2025 13:30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this no?

if ( self::plan_category( $license_data ) <= 1 ) {
do_action( 'themeisle_sdk_load_banner', 'feedzy' );
}
if ( in_array( $page_slug, array( 'imports', 'categories', 'settings' ) ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this anymore no, I mean calling twice this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The notice runs only once from the product that is loading.

If we have Otter with Feedzy, and Otter is the one that adds the last hook, the Otter message will be used for Global and product pages.

In the internal pages, we add the hook so that it can render on top of each other.

If we add the hook only on internal pages, then there is no conflict and on the non-product pages, the default message will be displayed.

@@ -77,6 +77,8 @@ function( $data, $page_slug ) {
);
}

apply_filters( 'themeisle_sdk_blackfriday_data', array( $this, 'set_black_friday_data' ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be add_filter, no?

$discount = '40%';

if ( feedzy_is_pro() ) {
$product_label = __( 'Feedzy RSS Feeds Pro', 'feedzy-rss-feeds' );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use Feedzy PRO

* @return array
*/
public function set_black_friday_data( $config ) {
$product_label = __( 'Feedzy RSS Feeds', 'feedzy-rss-feeds' );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use Feedzy

*/
public function set_black_friday_data( $config ) {
$product_label = __( 'Feedzy RSS Feeds', 'feedzy-rss-feeds' );
$discount = '40%';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use 70%


if ( feedzy_is_pro() ) {
$product_label = __( 'Feedzy RSS Feeds Pro', 'feedzy-rss-feeds' );
$discount = '50%';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use 30%

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use for pro this message Get 30% off when you upgrade your Feedzy Pro plan or renew early.

$config['url'] = add_query_arg( array(
'utm_plugin' => feedzy_is_pro() ? 'feedzy-pro' : 'feedzy-rss-feeds',
'utm_plan' => self::plan_category( $license_data ),
), $config['base_url'] );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use here

add_query_arg(
	[
		'utm_term' => feedzy_is_pro() ? 'plan-' . apply_filters( 'product_feedzy_license_plan', 0 ) : 'free'
	],
	tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/plugins/feedzy-rss-feeds/blackfriday', 'bfcm', 'feedzy' ) ) );

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Soare-Robert-Daniel lets also include the licensekey as lkey using product_feedzy_license_key

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The URL will look this: https://themeisle.com/plugins/feedzy-rss-feeds/blackfriday?utm_source=wpadmin&utm_medium=feedzy&utm_campaign=bfcm&utm_content=feedzy-rss-feedsblackfriday&utm_term=plan-3&lkey=d5498f84bc277aa7043bfc86f185c798

Since this is per user, should we restrict the lkey only to users who have the capabilities to manage plugins? This is not to leak the key to editors, etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, we can. Lets do this in the SDK, by using remove_query_arg if the url contains lkey and the user does not have the right permision.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this we have available the $current_product, should we use this to get the plan (priceID) and the license key directly from the SDK using the product_<slug> filters instead of having it in each product?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, I think is good as it is.

@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label May 12, 2025
@pirate-bot
Copy link
Contributor

pirate-bot commented May 12, 2025

Plugin build for 746b152 is ready 🛎️!

Note

You can preview the changes in the Playground

$discount = '30%';

// translators: %1$s - discount, %2$s - product label.
$config['message'] = sprintf( __( 'Get <strong>%1$s off</strong> when you upgrade your <strong>%2$s</strong> plan or renew early.', 'feedzy-rss-feeds' ), $discount, $product_label );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Soare-Robert-Daniel we need also to use placeholders for html tags, no need to send them for translation.

@Soare-Robert-Daniel Soare-Robert-Daniel requested a review from selul May 15, 2025 11:31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Soare-Robert-Daniel I guess we can delete this no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-checklist-complete The Pull Request checklist is complete. (automatic label) pr-checklist-skip Allow this Pull Request to skip checklist.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants