Commit Graph

42 Commits

Author SHA1 Message Date
Rodrigo Primo
acc8dde47d Add purchased with attribute segment UI code
[MAILPOET-5467]
2024-03-11 10:52:30 +01:00
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
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
Jan Jakes
54e6e11cf0 Fix latest coupon fetching logic
[MAILPOET-5169]
2023-06-19 11:06:23 +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
John Oleksowicz
ec68818c1a Add filter for used payment method
MAILPOET-4993
2023-05-19 11:57:13 +02:00
David Remer
e081c554aa Add method to retrieve order statuses
[MAILPOET-4935]
2023-03-30 12:21:25 +02:00
Jan Lysý
847132b433 Create new component for existing coupons
[MAILPOET-4890]
2023-02-22 13:07:40 +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
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
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
Jan Lysý
1730578a23 Use coupon id instead of text
[MAILPOET-4761]
2023-01-30 09:36:21 +01:00
Jan Lysý
40f4216ff8 Add method for getting WC coupons
[MAILPOET-4761]
2023-01-30 09:36:21 +01:00
Sam Najian
39d22bdd62 Move Coupon instantiation to MailPoet\WooCommerce\Helper
[MAILPOET-4678]
2023-01-23 13:31:34 +01:00
Sam Najian
48c075b730 Add WC helper function to retrieve coupon code from id
[MAILPOET-4678]
2023-01-23 13:31:34 +01:00
Sam Najian
199910a52f Add coupon block config
[MAILPOET-4678]
2023-01-23 13:31:34 +01:00
John Oleksowicz
761f7c6537 Prevent issues if other plugins define WC function
It's possible that other plugins might define wc_get_page_id, so it's
more important to know that WC is installed/active than to know if the
function itself exists.

For good measure I'm including a cast to int even though the WC version
of the function always returns an integer. This is probably unnecessary
but it protects us from the possibility of the WC version of the
function returning something other than an integer in the future.

[MAILPOET-4834]
2022-11-30 11:03:40 +01:00
Jan Jakes
926620e8f8 Ignore strict types rule in all existing files that don't have it
[MAILPOET-2688]
2022-11-29 15:04:09 +01:00
Oluwaseun Olorunsola
b6e7e39fb0 Rename method and move wcGetPageId to Woo helper class
MAILPOET-4663
2022-11-01 14:58:47 +01:00
Rostislav Wolny
9df99b1a00 Add method for getting customers count to WooCommerce helper
[MAILPOET-4652]
2022-10-24 15:16:04 +02:00
Rodrigo Primo
dd1fcd5100 Add helper method to get the name of the WooCommerce order addresses table
[MAILPOET-4711]
2022-10-19 11:32:41 +02:00
Rodrigo Primo
f734091e34 Replace PHP's builtin exception with Mailpoet's RuntimeException
Use a more specific exception.

[MAILPOET-4577]
2022-10-05 10:47:06 +02:00
Rodrigo Primo
ff105f8e61 Add helper method to get the name of the WooCommerce orders table
[MAILPOET-4577]
2022-10-05 10:47:06 +02:00
Rodrigo Primo
b592ce743d Use Woo native function instead of custom query in getOrdersCountCreatedBefore()
[MAILPOET-4570]
2022-10-03 15:10:36 +02:00
Rodrigo Primo
842f81d40b Add method to detected if WooCommerce Custom Order Tables is enabled
[MAILPOET-4567]
2022-09-09 10:43:11 +02:00
John Oleksowicz
90dcbc2749 Add create order to WC helper
MAILPOET-4566
2022-09-08 13:02:52 +02:00
Rodrigo Primo
de4e76b65d Use is_array() instead of !empty() for a safer check
Just in case the option is changed and is not an array anymore.

[MAILPOET-4491]
2022-08-04 10:18:44 +02:00
Rodrigo Primo
13e06fe0cb Add helper method to check if MailPoet was installed via WooCommerce
The method will return true if MailPoet was installed via the
WooCommerce onboarding wizard and false otherwise.

[MAILPOET-4491]
2022-08-04 10:18:44 +02:00
David Remer
9f39843189 Sanitize incoming data according to WP sniffer
[MAILPOET-4219]
2022-04-04 17:12:33 +02:00
Sam Najian
a2ab1a3cfd Escape queries before passing to $wpdb methods
[MAILPOET-4219]
2022-04-04 17:12:33 +02:00
Jan Jakes
9f790efbf0 Move plugin files to a subfolder
[MAILPOET-3988]
2022-01-18 15:30:22 +01:00