Commit Graph

31 Commits

Author SHA1 Message Date
Rostislav Wolny
65b834a9ff Update renamed NotCamelCaps rule
[MAILPOET-3658]
2021-07-06 13:29:00 +02:00
wxa
dd6aff01db Fix duplicate automatic email for same product
[MAILPOET-3254]

It was happening when a second order was placed which contained the same product and some additional product.
2021-03-29 10:32:37 +02:00
Rodrigo Primo
3a1c2b61a3 Fix PHP notice when the plugin user-switching is active
Some users were getting the PHP notice below when using the
user-switching (https://wordpress.org/plugins/user-switching/) plugin
to switch to a different user.

```
PHP Notice: get_cart was called incorrectly. Get cart should not be called before the wp_loaded action.
```

This notice is generated by WooCommerce when `WC_Cart::get_cart()` is
called before the `wp_loaded` action. user-switching calls a WooCommerce
method to empty the user session and the cart when switching users and
this happens before wp_loaded. MailPoet hooks into the
woocommerce_cart_emptied action
(c9ca134d30/lib/AutomaticEmails/WooCommerce/Events/AbandonedCart.php (L118))
to decide whether it should schedule or cancel an abandoned cart email.
When doing so, it calls WC_Cart::is_empty() which calls
WC_Cart::get_cart(). This is why the PHP notice is generated.

When the cart is emptied we don't need to check it again calling
WC_Cart::is_empty(). So, to get rid of the PHP notice, this commit adds an
extra condition to the if statement to only run WC_Cart::is_empty() if
the current action is not `woocommerce_cart_emptied`.

[MAILPOET-3374]
2021-03-01 14:44:38 +01:00
Rodrigo Primo
575b34fc97 Fix "Purchased In This Category" email for product variations
The "Purchased In This Category" email was not working for variable
products. This was happening because MailPoet calls
WC_Product::get_category_ids() to get the list of WooCommerce
categories associated with a given product, but this method doesn't work
for product variations (see
https://github.com/woocommerce/woocommerce/issues/12942).

In this commit, I'm implementing a workaround. I changed the code to
check if the product is a product variation and, if so, get the
categories from the parent product instead of the product itself. But I
also plan to raise this issue with the WooCommerce team as, in my opinion,
it is odd that WC_Product::get_category_ids() doesn't work with product
variations and fails silently.

[MAILPOET-3416]
2021-03-01 13:32:52 +01:00
Jan Lysý
8001cd1336 Replace assert the annotation of the variable
[MAILPOET-3235]
2021-01-18 14:39:42 +01:00
Jan Lysý
4390a1932d Remove phpstan errors from the rest of the code
[MAILPOET-3235]
2021-01-18 14:39:42 +01:00
Pavel Dohnal
daaeada3da Match select boxes with same select boxes in segments
[MAILPOET-2553]
2020-12-03 10:09:51 +01:00
Pavel Dohnal
78118b07e8 Refactor to doctrine
[MAILPOET-2335] [MAILPOET-2334]
2020-10-22 11:54:41 +02:00
Pavel Dohnal
f8bd946dc0 Check sent emails for products when schedulig an email
[MAILPOET-2335] [MAILPOET-2334]
2020-10-22 11:54:41 +02:00
Pavel Dohnal
e591c4f638 Save product id when scheduling an automatic email
[MAILPOET-2335] [MAILPOET-2334]
2020-10-22 11:54:41 +02:00
Pavel Dohnal
eaa94c5ce8 Update description
[MAILPOET-2335] [MAILPOET-2334]
2020-10-22 11:54:41 +02:00
Pavel Dohnal
9e8ccd2c17 Use native array_column
[MAILPOET-3173]
2020-10-12 10:10:03 +02:00
wxa
52b84296b3 Add abandoned cart block rendering in email [MAILPOET-2979] 2020-10-07 11:48:50 +02:00
Pavel Dohnal
e48bb4ee23 Reworded a description
[MAILPOET-3121]
2020-09-02 16:29:28 +02:00
Jan Jakeš
685b4885c0 Exclude WordPress and WooCommerce variables from camel case conversion
[MAILPOET-1796]
2020-01-14 15:22:42 +01:00
Jan Jakeš
8c848cfa28 Convert property names to camel case
[MAILPOET-1796]
2020-01-14 15:22:42 +01:00
Jan Jakeš
54549ff037 Convert variable names to camel case
[MAILPOET-1796]
2020-01-14 15:22:42 +01:00
Amine Ben hammou
43df66d162 Add public keyword to methods
[MAILPOET-2413]
2019-12-26 18:09:45 +03:00
Rostislav Wolny
d3ce76f88d Use instance of checks for detecting WCProduct
[MAILPOET-2586]
2019-12-19 18:08:26 +00:00
Rostislav Wolny
73e9cc3517 Apply array_values on filtered array of product ids
[MAILPOET-2586]
2019-12-19 18:08:26 +00:00
Rostislav Wolny
d41dabd1b7 Skip order items which are not product in PurchasedProduc scheduling
[MAILPOET-2586]
2019-12-19 18:08:26 +00:00
Rostislav Wolny
3d2b2f0858 Skip order items which are not product in PurchaseCategory scheduling
[MAILPOET-2586]
2019-12-19 18:08:26 +00:00
Jan Jakeš
0e964de6d4 Move nesbot/carbon to vendor-prefixed
[MAILPOET-2560]
2019-12-15 21:55:48 +00:00
Jan Jakeš
a012984a7a Move array_column polyfill to MailPoetVendor namespace
[MAILPOET-2545]
2019-11-27 12:38:20 +00:00
Rostislav Wolny
9fbaa92c9b Refactor AutomaticEmails to use logger_factory instance
[MAILPOET-2444]
2019-10-10 12:36:06 +01:00
Rostislav Wolny
beccbea6e2 Refactor Mailpoet\Logging\Logger to LoggerFactory
[MAILPOET-2444]
2019-10-10 12:36:06 +01:00
Jan Jakeš
e051870eb5 Move 'getCustomerOrderCount' from Helper to where it's used, remove Helper
[MAILPOET-2382]
2019-10-08 14:22:55 +01:00
Jan Jakeš
25d9ffa656 Move getWooCommerceSegmentSubscriber() from helper to model
[MAILPOET-2382]
2019-10-08 14:22:55 +01:00
Jan Jakeš
33b243f787 Fix calling method_exists() on string
[MAILPOET-2382]
2019-10-08 14:22:55 +01:00
Jan Jakeš
8fd5f987a9 Remove Premium namespace from automatic emails
[MAILPOET-2382]
2019-10-08 14:22:55 +01:00
Jan Jakeš
5ceb4a9343 Move automatic emails from Premium plugin
[MAILPOET-2382]
2019-10-08 14:22:55 +01:00