email – How to unsubscribe customers on mass / bulk in Magento 2.3

We have migrated from M1 to M2, and it appears on M1 we had customers “subscribed” in Magento admin but had subsequently unsubscribed in our email platform. Unfortunately, this had not synced back to Magento 1 and was one way. Therefore when moving to Magento 2, it began to re-subscribe customers that should be unsubscribed.

We have around 30k subscribers that need unsubscribing, which I can find in the newsletter_subscriber table and comparing to our email provider’s db.
However changing subscriber_status field in the db from 1 to 3 (subscribe to unsubscribe) does not appear to work, and I suspect a customer save also needs to happen, but not sure how to do this.

Any ideas, either to save all customers pragmatically, or to unsubscribe pragmatically?
I have a list of emails or subscriber_id’s and customer id’s

Magento 2 sitemap url does not work after we add any rewrite rule in root htaccess file

Our sitemap URL works fine at /sitemap/sitemap.xml but as soon as we add any rewrite rule in root .htaccess file then it gives status code 404 page not found.

RewriteRule ^abc/(.*)?$ /media/doc/files/abc/$1 (R=301,NC,L)

Magento version 2.2.5

magento2 – How to make checkbox Check/Uncheck onchange trigger event to subscribe/unsubscribe customer from newsletter magento 2 on customer/account?

Basically I have a checkbox on customer/account page adding via code below.

<div class="col-12 col-sm-12">
            <div class="flex-card myaccount-block proofing-block">
                <div class="col-lg-3 float-left">
                <img src="" alt="Automatic Proofing Approval Options" />
                <div class="col-lg-6 float-left">
                    <strong class="box-title">
                        <span><?= $block->escapeHtml(__('Automatic Proofing Approval Options')) ?></span>
                    <div class="box-content">
                        <p><?= $block->escapeHtml(__('
                        By default, once your file is preflighted OK, you will have 1 hour to approve or make changes to your file. If no action is taken within this hour, your order will automatically go into production.')) ?>
                        <a href="#" id="proof-learnmore">Learn More..</a>
                <div class="col-lg-3 float-left">
                    <span class="yesno-label">Yes</span>
                    <div class="box-actions">
                            <label class="proof-switch">
                            <input type="checkbox">
                            <span class="slider round"></span></label>
                    <span class="yesno-label">No</span>

How can I create a functionality so whenever user check/uncheck this checkbox it will call an observer/controller which will pass the value(customer_email) to magento backend and change the newsletter subscription status? I hope I am on the right track of understanding cause this is what I am planning to implement. I am still not sure whether I will need a block or not. Please anyone guide me through this it would be really helpful for me to continue my learning and understand magento 2. Thank you and cheers. Though I am trying my best to implement this and update here if something relevant
enter image description here

Magento2 When does magento considers a cart to be abandoned

Magento2 I would like to know when does Magento consider a cart to be Abandoned.

In short, is there any specific changes made in cart or cart table when notifies that the cart is abandoned cart.

cache – Any Drawback on running setup:upgrade, di:compile, static deploy everytime code level edit on Magento 2

Is it ok to run the following set of commands by default everytime I make a code level edit (layout edits, module creation, extension update)

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static:content:deploy -f
php bin/magento c:f
chmod -R 777 generated/ var/ pub/

I believe that not all edits require, setup upgrade or di:compile.
But, does running all above set of commands even if not required cause any issue.

magento2 – Magento 2.3.x Admin Panel keeps loading

I have installed Magento 2.3.5-p1 and also tried 2.3.4-p2 on Centos 7, with Nginx & PHP-FPM, maria DB with following commands.

1. /var/www/magento < owner by MAGENTO:NGINX user (I have created a pool for magento:nginx)
2. find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
3. find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
4. chmod u+x bin/magento
6. su magento

7.  bin/magento setup:install --base-url='' 
--db-host='localhost' --db-name='' --db-user='' 
--db-password='' --admin-firstname='example' 
--admin-lastname='Admin' --admin-email='' 
--admin-user='admin' --admin-password='' --language='en_US' 
--currency='USD' --timezone='UTC' --use-rewrites=1 --use-secure-admin=1 --use-secure=1

Once completed, my FRONTEND (home page) works absolutely fine, i just have 2 errors in the javascript console log:

(Error) Failed to load resource: the server responded with a status of 404 () (requirejs-config.js, line 0)
(Error) Refused to execute as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.

But when I open admin panel, I can login into it. However, after logging in it keeps loading. I have tried several methods available online such as:

1. rm -rf pub/static/* (except .htaccess) refresh page
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile
vi app/etc/di.xml <-- Change Symlink to Copy
rm -rf pub/static/*
refresh page
rm -rf var/*
bin/magento setup:static-content:deploy -f
bin/magento c:c
5. bin/magento cache:enable

I have tried to install it under both php-fpm and nginx group, also as nginx:nginx. Nothing works, admin panel just keeps loading.

What am I missing here?

The errors i get on admin panel JS console logs

enter image description here

How to get product id’s of first page in the second page in magento 2 plp

I need to get first page product id’s while calling second page collection in ListProduct.php

magento2 – magento1 migrate to multiple magento 2 stores

Anyone knows what happen for all the migrate changes tables in m1, if I want to start migration to a new m2 store.

E.g. I migrated m1 data to the first m2 store and all the deltalog tables (with prefix m2_cl_*) and triggers (for tracking changes) have been created in the M1. Now I want m1 data to migrate to an another m2 store. What will happen will all the deltalog tables and triggers. Will they be dropped and recreated? I use Magento data migration tool.

product – Magento 2.3.5: What is the correct technique to update stock?

I have tried to follow the next solution:
Magento 2: Programmatically Updating Inventory

But in Magento 2.3.5 this solution is deprecated.

Currently what is the solution to update stock?

My code:

public function updateProductStockByData(array $data)
    $skuArray = $this->getMapWithSkuKey($data);

    try {
        $productIds = $this->getMapWithProductIdKey($skuArray);
        if (count($productIds)) {
            $searchCriteria = $this->getSearchCriteria($productIds);
            $stockItemCollection = $this->stockItemRepository->getList($searchCriteria);
            if ($stockItemCollection->getTotalCount()) {
                /** @var MagentoCatalogInventoryModelStockItem $stockItem */
                foreach ($stockItemCollection->getItems() as $stockItem) {
                    $newQty = $this->dataDictionaryWithProductIdKey($stockItem->getProductId())('STOCK');
                    if ($stockItem->getQty() == 0) {
    } catch (Exception $exception) {