Commit Graph

108 Commits

Author SHA1 Message Date
John Oleksowicz
b1dd110bf8 Add lookup data retrieval for used shipping method
For ease of lookup, I changed the helper to return an array with keys
corresponding to the instanceId of the shipping methods. I couldn't see
anywhere else in the codebase where the keys would have mattered.

MAILPOET-5625
2023-10-13 11:21:42 +02:00
David Remer
17ca776189 Ensure that woocommerce is actually active
[MAILPOTE-5613]
2023-10-11 10:19:24 +02:00
Rostislav Wolny
eb12069122 Ensure the integer is returned when we call paginated wc_get_orders
In Woo 8.2.0-beta.1, the total value was null. In this commit I want to
make sure we always return an integer.
[MAILPOET-5621]
2023-10-03 10:00:56 +02:00
Jan Lysý
26417bab52 Change Coupon API parameter from include_coupon_id to include_coupon_id
[MAILPOET-5123]
2023-09-25 02:28:51 -07:00
Jan Lysý
79d506ca34 Create new API endpoint for WC coupons
Because I haven't found an easy way how to use WP or WC API,
I decided to create a MailPoet endpoint for getting coupons that
allows me loading them via Ajax.
[MAILPOET-5123]
2023-09-25 02:28:51 -07:00
David Remer
05b45173d6 Add event option to tracking
[MAILPOET-5485]
2023-09-11 12:14:33 +02:00
David Remer
7a2ddd0053 Track only completed orders
[MAILPOET-5485]
2023-09-11 12:14:33 +02:00
David Remer
30eafb9146 Extract purchase states to helper method
[MAILPOET-5485]
2023-09-11 12:14:33 +02:00
John Oleksowicz
acc7084b65 Ensure shipping method instanceIds are strings
Selected shipping methods were not appearing when after saving and
reloading a segment because the instanceIds were actually coming through
 as integers, while the values are getting saved as strings.

MAILPOET-5496
2023-08-17 13:49:08 +02:00
Rodrigo Primo
841745c706 Remove shipping method IDs from the 'used shipping method' query
This commit simplifies the logic of the 'used shipping method' segment
by removing the shipping method IDs from the queries. After some
considering, we have come to the conclusion that using just the shipping
method instance ID is enough.

[MAILPOET-4992]
2023-07-04 22:23:06 +02:00
Rodrigo Primo
f85b7a52fc Change logic of the code to build the 'used shipping method' segment UI
This commit fixes an issue with the initial logic used to retrieve
shipping methods to build the UI of the 'used shipping method' segment.
It updates the code to properly retrieve WooCommerce shipping methods
configured for all zones. Before the code was getting just the shipping
method types and the shipping method instances.

The query that is used to get the subscribers that match this segment
will be updated in another commit.

[MAILPOET-4992]
2023-07-04 22:23:06 +02:00
Rodrigo Primo
243c096643 Add UI for new "used shipping method" segment
[MAILPOET-4992]
2023-07-04 22:23:06 +02:00
David Remer
190da3b0e5 Use WooCommerce wrapper instead of native functions, test if WC is active
[MAILPOET-5092]
2023-07-03 12:44:07 +02:00
John Oleksowicz
0e9b96d0b7 Track opens, clicks, purchases, and page views
MAILPOET-4998
2023-06-22 15:29:22 +02:00
Jan Jakes
54e6e11cf0 Fix latest coupon fetching logic
[MAILPOET-5169]
2023-06-19 11:06:23 +02:00
Rodrigo Primo
206bd7fbab Fix layout error in the optin checkbox for some WP themes
This commit fix a layout error in the optin checkbox that MailPoet adds
to the WooCommerce checkout when the site is using the themes Twenty
Twenty-Two and Twenty Twenty-Three.

This problem was happening because WooCommerce add CSS to make its own
checkboxes work with those two themes, but it broke checkboxes the
layout of checkboxes created with woocommerce_form_field().

The Woo checkboxes in the checkout display the text inside an <span>
element and that doesn't happen for checkboxes created with
woocommerce_form_field(). The problem is in those CSS rules:

0ea5205672/plugins/woocommerce/client/legacy/css/twenty-twenty-three.scss (L731-L757)

[MAILPOET-4133]
2023-06-01 11:38:54 +02:00
Rodrigo Primo
cd43cfbb1f Fix typo
[MAILPOET-4178]

Co-authored-by: John Oleksowicz <8656640+johnolek@users.noreply.github.com>
2023-05-30 13:25:24 +02:00
Rodrigo Primo
80655813b7 Stop subscribing customers to the Woo list when they are created
This commit changes the behavior of
\MailPoet\Segments\WooCommerce::synchronizeRegisteredCustomer(). This
method is called when a new WooCommerce customer is created. Before, it
would always add the customer to the Woo segment expecting
\MailPoet\WooCommerce\Subscription::subscribeOnCheckout() to unsubscribe
the customer if the optin checkbox was not checked.

Since the behavior of the latter method changed in a previous commit and
it doesn't unsubscribe customers anymoreif the option checkbox is not
checked, the former method had to be updated to only subscribe the customer
if not in checkout context or if in checkout context and optin checkbox is
enabled and checked.

[MAILPOET-4178]
2023-05-30 13:25:24 +02:00
Rodrigo Primo
d6e0768e1f Change the behavior of the optin checkbox in the Woo checkout
This commit changes the behavior of the optin checkbox that MailPoet
adds to the WooCommerce checkout.

Now the checkbox is not checked by default for logged in users who
already subscribed to a list. Also, users won't be unsubscribed anymore
and have their global status change to unsubscribed if they uncheck the
checkbox.

The only action that is performed after this change is to subscribe
users if they check the checkbox.

This change was implemented both for the normal checkout and the block
checkout.

It was also necessary to remove the AutomateWoo integration that
depended on subscribers being unsubscribed during checkout.

[MAILPOET-4178]
2023-05-30 13:25:24 +02:00
David Remer
09f984689f Make strings translateable
[MAILPOET-4973]
2023-05-29 10:53:38 +02:00
David Remer
28b38ef8f5 Add MailPoet info to WooCommerce System Status Report
[MAILPOET-4973]
2023-05-29 10:53:38 +02:00
John Oleksowicz
ec68818c1a Add filter for used payment method
MAILPOET-4993
2023-05-19 11:57:13 +02:00
Brezo Cordero
c0ffcbac9b Opt out when subscription unchecked
This commit adds an action when customer unsubscribes to WooCommerce segment on checkout and opt outs Automate Woo customer.

[MAILPOET-4230]
2023-05-15 12:04:24 +02:00
Brezo Cordero
00e5dea5b4 Opt out AutomateWoo customer
This commit adds an action to opt out AutomateWoo customer When MailPoet Subscriber global status changes to unsubscribed.

[MAILPOET-4230]
2023-05-15 12:04:24 +02:00
Oluwaseun Olorunsola
feba707c76 Use dependency injection (DI) for process shortcodes
MAILPOET-5110
2023-04-03 13:36:04 +02:00
Oluwaseun Olorunsola
c75dc63cc5 Process Shortcodes in WooCommerce custom template
MAILPOET-5110
2023-04-03 13:36:04 +02:00
David Remer
e081c554aa Add method to retrieve order statuses
[MAILPOET-4935]
2023-03-30 12:21:25 +02:00
Rostislav Wolny
d832925107 Remove temporary static property for the plugin main page
The property was added so that we were able to set the main page
dynamically based on the feature switch value. This is no longer needed and
we can use the hardcoded constant as we did before.
[MAILPOET-4831]
2023-03-13 14:09:17 +01:00
alex-mailpoet
a9b4b57fd6 Merge checkout opt-ins from AutomateWoo and MailPoet
[MAILPOET-5057]
2023-03-06 11:22:58 +01:00
Sam Najian
6a1e734633 Fix WooCommerce wording
[MAILPOET-5098]
2023-03-02 11:30:38 +01:00
Sam Najian
4192f82d29 Throw instead of directly logging when WC is not active
[MAILPOET-4983]
2023-03-01 17:46:22 +01:00
Sam Najian
93110826e7 Log when processing the queue for corrupt newsletter
[MAILPOET-4983]
2023-03-01 17:46:22 +01:00
Sam Najian
976c374cb7 Catch exception when processing coupon block throws
When processing coupon block throws, the exception is
caught, custom exception is thrown and the newsletter status
is updated

[MAILPOET-4983]
2023-03-01 17:46:22 +01:00
Sam Najian
2a6b7cd210 Log WC is inactive when trying to generate coupon
[MAILPOET-4983]
2023-03-01 17:46:22 +01:00
Jan Lysý
12456828fe Fix mapping products and categories for new coupon
[MAILPOET-4890]
2023-02-22 13:07:40 +01:00
Jan Lysý
767e6f4fbf Fix renamed coupon block attributes
[MAILPOET-4890]
2023-02-22 13:07:40 +01:00
Jan Lysý
847132b433 Create new component for existing coupons
[MAILPOET-4890]
2023-02-22 13:07:40 +01:00
Rodrigo Primo
4966d45d5e Update copy of the MailPoet link added to the WooCommerce task list
[MAILPOET-5063]
2023-02-19 11:24:52 +01:00
Oluwaseun Olorunsola
7858d4ada2 Link to the new homepage from the MailPoet task in WooCommerce
MAILPOET-4926
2023-02-06 13:38:33 +01:00
Rostislav Wolny
3c89bf2f0d Remove currency from the Woo Tracker data
The currency is already tracked by Woo core under settings.currency.
[MAILPOET-5037]
2023-02-06 12:13:27 +01:00
Jan Lysý
3b5a96a3f7 Add test case that coupon is rendered correctly
[MAILPOET-4984]
2023-02-01 11:21:49 +01:00
Rodrigo Primo
8d57e81b99 Use return type hint instead of docblock to tell PHP the return type
[MAILPOET-4814]
2023-01-30 15:01:42 +01:00
Rodrigo Primo
8a4f5c13da Add tracking for users arriving to the wizard from WooCommerce
MailPoet adds a link to the WooCommerce task list pointing to its own
welcome wizard. We want to track users that arrive to the MP wizard from
WooCommerce but at this point tracking is not enabled. So we store the
information in a setting, and send the tracking event to Mixpanel, if it
is enabled, after the user completes the wizard.

[MAILPOET-4814]
2023-01-30 15:01:42 +01:00
Rodrigo Primo
1161e6f3f6 Add MailPoet task to WooCommerce homepage
[MAILPOET-4814]
2023-01-30 15:01:42 +01:00
Sam Najian
05e941e449 Allow dynamic genration of coupon code for some newsletters
Those newsletters that allow updating their body html should
persist the couponId along side the Coupon block settings so
that on the next rendering attempt the same coupon code is
used

[MAILPOET-4763]
2023-01-30 12:46:38 +01:00
Oluwaseun Olorunsola
494723c818 Use WooCommerce decimal separators when validating input fields
We need to use the decimal separators selected by the user for our validation. We are also using the validation used on the adding/editing coupon page

MAILPOET-4762
2023-01-30 11:48:48 +01:00
Oluwaseun Olorunsola
b07d34ee23 Fix tests
MAILPOET-4762
2023-01-30 11:48:48 +01:00
Oluwaseun Olorunsola
4b2b94db9e Add Products and Exclude products Usage restriction fields
MAILPOET-4762
2023-01-30 11:48:48 +01:00
Oluwaseun Olorunsola
77b9cea62c Add Product categories and Exclude categories Usage restriction fields
MAILPOET-4762
2023-01-30 11:48:48 +01:00
Oluwaseun Olorunsola
7549ed7f0f Add other WooCommerce coupon option methods
MAILPOET-4762
2023-01-30 11:48:48 +01:00