Skip to content
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

New WooCommerce segment: single order value [MAILPOET-4988] #4799

Merged
merged 4 commits into from
Mar 28, 2023

Conversation

rodrigoprimo
Copy link
Contributor

@rodrigoprimo rodrigoprimo commented Mar 17, 2023

Description

This PR adds a new WooCommerce segment called "single order value". It allows users to create segments based on the value of a single order made by customers. For example, customers that placed an order with a total value equal to or higher than $1000 in the last seven days.

Code review notes

I based this segment on the WooCommere total spent segment.

QA notes

To test this new segment:

  • Create a few WooCommerce others with different customers. This can be done via the web interface or using wc-smooth-generator.
  • Go to /wp-admin/admin.php?page=mailpoet-segments#/new-segment and create a new segment of the type single order value.
  • Send an email using this segment and confirm that the recipients of the email are the expected WooCommerce customers that placed at least one order that matched the criteria chosen when creating the segment.

Linked PRs

N/A

Linked tickets

MAILPOET-4988

After-merge notes

N/A

@rodrigoprimo rodrigoprimo force-pushed the new-segment-single-order-value branch from 064d659 to 662d429 Compare March 17, 2023 14:09
@rodrigoprimo
Copy link
Contributor Author

@triple0t, right after I created this PR, I noticed a conflict due to a change that landed in trunk after I created this branch. I fixed the conflict and force-pushed the changes now.

Copy link
Contributor

@triple0t triple0t left a comment

Choose a reason for hiding this comment

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

LGTM

@triple0t triple0t requested a review from veljkho March 20, 2023 16:21
@triple0t triple0t assigned Aschepikov and veljkho and unassigned triple0t Mar 20, 2023
@Aschepikov
Copy link
Collaborator

Aschepikov commented Mar 28, 2023

Hi, @rodrigoprimo I have one issue with this segment, always when I am making a new order I see just the last subscriber in the segment. So there is always one last subscriber even if I have a few subscribers with correct orders for the segment requirements.
Example 1, I have here 3 orders 45 (1 order with subscriber), 15 (2 order with subscriber), and 60 (3 order with unsubscribed) in total
image
I am creating a segment with more than 30 in total in the last 7 days, and it shows just 1 subscriber from the last order for 60 in total
image
And this email is not a subscriber.
image
But it is the last order
image
The correct subscriber was 45 in total from the 1 order
image
And I had it in the segment, but after the last order, this subscriber disappeared from the segment list. If I will create a new one there will be just 1 last subscriber.

I thought that problem could be related to hpos enabled on this site, so I tried it on a new one.

Example 2. I have two orders 72 and 110 in total
image
But in the list with more than 30 in the last 10 days I have just one last subscriber
image
It is a second subscriber from the second order and this subscriber replaced the first one in the segment
image
Now I can create a new order with the third subscriber
image
I will see it in the orders
image
But in the segment, I still have just one subscriber
image
And it is a last subscriber from the third order
image

@Aschepikov Aschepikov assigned rodrigoprimo and unassigned veljkho and Aschepikov Mar 28, 2023
@Aschepikov
Copy link
Collaborator

I checked it with the "total spent" segment too and it works the same just the last one subscriber
image
image
And segment is in country too
image

So I guess it is an issue of all woocommerce segments and it is not connected with single order value

@rodrigoprimo
Copy link
Contributor Author

Thanks for sharing the credentials to your site, @Aschepikov.

I believe that the problem is that all the orders are associated with the same user. They do have different email addresses, but the customer is always "Test Test" (customer ID 1):

Screenshot from 2023-03-28 10-26-56

Copy link
Collaborator

@Aschepikov Aschepikov left a comment

Choose a reason for hiding this comment

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

OMG My fault, sorry. How I can forget about it?! GJ anyway!

@Aschepikov Aschepikov merged commit 8e02119 into trunk Mar 28, 2023
@Aschepikov Aschepikov deleted the new-segment-single-order-value branch March 28, 2023 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants