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]
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]
Initially, I had opted to use getReference() to avoid querying the
database to get the segment entities as all we need is the segment ID.
But I hadn't realized that this could cause problems if a segment that
is saved in the settings in the option woocommerce.segments is deleted.
Using findBy() here protects against this problem as, if the segment
doesn't exist anymore, it won't be returned.
[MAILPOET-4365]
Besides Subscription::subscribeOnCheckout(), this commit also replaces
Paris models with Doctrine entities in all the methods that are called
by Subscription::subscribeOnCheckout().
[MAILPOET-4365]