magento2 – Magento 2: How to redirect to current store url with parameters in url from `controller_action_postdispatch` observer [Google search index issue]

When I enter my site’s internal URL for example-
It redirects me to the home page and also shows the error in
Google Search Console showing URL is not available to Google as
shown in the screenshot.

What I want is My Url should be redirected to the current store URL(not base URL) and also not show an error in Google Search Console.


I’m redirecting to a different store following way which is not the correct way to redirect to store Url, Also it’s redirected as expected but shows the error in google search

$storeId = 1;
$urlInterface = MagentoFrameworkAppObjectManager::getInstance()->get('MagentoFrameworkUrlInterface');
$redirecturl = $urlInterface->getCurrentUrl();
$redirecturl = str_replace($this->storeManager->getStore()->getBaseUrl(), '', $redirecturl);
$redirecturl = explode('?', $redirecturl);
$observer->getControllerAction()->getResponse()->setRedirect($store->getBaseUrl().redirecturl(0)."?geoipss_redirect=1&gipss_store_id=".$storeId); //redirecturl(0) == 'women/tops'
return $this;

I have tried adding a static URL that works fine in setRedirect()
but I need to redirect to a specific store’s current URL(not base

I have also tried with
$this->storeManager->getStore()->getCurrentUrl() it shows error in
google search.

Let me know If anyone has any idea.

Utilizar modulo da vendor, em um tema especifico magento 2

eu estou em um projeto de criação de um e-commerce, e preciso alterar um componente do modulo_whitelist, só que não quero alterar diretamente o arquivo que está na vendor, e queria criar esse modulo dentro das minhas próprias pastas. Eu sei que é possível fazer uma coisa parecida com outros módulos, como por exemplo o modulo_catalog do magento luma, que posso criar as pastas dentro do meu thema e o magento, le primeiro localmente. Como eu poderia fazer isso com o whitelist. ?

magento2 – Magento 2 validation exception message not translated

At checkout page, when I click place order without accepting the terms and conditions the validation error it’s showed in english instead of spanish. However, the store shows the interface in spanish and the translation line of that exact message is in the csv translation file

magento2.4 – magento 2 sort child products according swatches in product view page

I wanna sort the child products of configurable according to display swatches.
I wanna sort the child products in product page.

Product page swatches display like this Green,White,Black
When I use my below code its fetching child products but not sort according to swatches. How swatches sorted and display, and what should I change in my below code ?

$childItems = ();
        $_objectManager = MagentoFrameworkAppObjectManager::getInstance();
        $_product = $_objectManager->get('MagentoFrameworkRegistry')->registry('current_product');
            if($_product->getTypeId() == "configurable"){
            $imageBuilder= $_objectManager->get('MagentoCatalogModelProductImageUrlBuilder');
                $allProducts = $_product->getTypeInstance()->getUsedProducts($_product, null);
                foreach ($allProducts as $product) {
                    $productStockObj =  $objectManager->get('MagentoCatalogInventoryApiStockRegistryInterface')->getStockItem($product->getId());
                   if ($productStockObj->getIsInStock()){
                    $childItems() = $product->getSku();

When I run above code it displays the child array like this sku-white,sku-black,sku-green

I want sort the child items according display swatches

Need to generate the invoice automatically once the shipment is created. [Magento 2.3.3 EE]

I want to generate the invoice automatically once the shipment is created. (Magento 2.3.3 EE)

More details as follows:

  • Automatically create an invoice based on orders with shipment created

  • Automatically send invoice emails to customer

  • Create an automatic invoice for each shipment created in the order(s) against each sub order created

  • Discounts, shipment, COD charges, etc should be divided appropriately in each sub-order & invoice for the order

Magento 2 Sales order creation upon checkout

I’m in the process of migration from v1.9 – v2.4 and realized that the sales orders are only created in Admin Panel after successful payment. Is there a way to configure it to behave like v1 where the order is created upon clicking Place Order? It used to create a Pending Payment order and had its status updated after payment (processing/cancelled).

magento2 – Magento 2 – Ko Js – Multiple Instance of component in the same page

I am trying to add two templates with the same component, but i need that each template do not share observables and computed this with the other template. I need each one have it own instance of the component.

Is it possible? i spend some hours and i could not find the solution even in this forum.

    <div id="inbox" class="inbox-wrapper" data-bind="scope:'inbox'">
    <div class="inbox" data-bind="click: toggle">
        <i class="fas fa-envelope fa-lg"></i>
        <span class="counter" data-bind="text: messageCount, visible: messageCount, css: pop" style="display: none;"></span>
    <!-- ko template: getTemplate() --><!-- /ko -->
<div id="notifications" class="inbox-wrapper" data-bind="scope:'notifications'">
    <div class="inbox" data-bind="click: toggle">
        <i class="fas fa-bell fa-lg"></i>
        <span class="counter" data-bind="text: messageCount, visible: messageCount, css: pop" style="display: none;"></span>
    <!-- ko template: getTemplate() --><!-- /ko -->
<script type="text/x-magento-init">
        "#notifications": {
            "Magento_Ui/js/core/app": {
               "components": {
                    "notifications": {
                        "component": "Digibart_Notifications/js/component/notifications",
                        "template": "Digibart_Notifications/notifications",
                        "identifier": "<?= $block->getIdentifier(); ?>",
                        "options": <?= $block->getJsonOptions();?>,
                        "elementsId": "#notifications"
        "#inbox": {
            "Magento_Ui/js/core/app": {
               "components": {
                    "inbox": {
                        "component": "Digibart_Notifications/js/component/notifications",
                        "template": "Digibart_Notifications/inbox",
                        "identifier": "<?= $block->getIdentifier(); ?>",
                        "options": <?= $block->getJsonOptions();?>,
                        "elementsId": "#inbox"

How to make a ‘clone’ of our Magento environment? And is that even necessary before using the Magento Migration tool?

Magento 1.9.4

I’m about to run the Magento Migration Tool and it says in the documentation to run it against a clone and not a real production website. Is that really necessary if we don’t mind the potential downtime? (I guess we need to switch our Magento 1 stores to maintenance mode before starting the migration to Magento 2?)

What are the real chances of damage being done to the Magento 1 store when running the Magento Migration tool? Doesn’t it just copy files?

We have Jetbackups which should allow us to do a full restore within an hour. If there is no real danger of damage to the Magento 1 store, I might just take my chances and then do the restore if needs to be.

magento2 – Linking InsertListings – Magento Stack Exchange

I have two database tables, zones and rules. The rules includes a foreign key to the zones table (i.e. zone_id) and I wish to create an admin form to edit these.

The zone edit form includes the various fields of the zone in one fieldset and an insertListings ui component in another. At the moment the rules listings shows all listings, for every single zone, but I want to limit this to the zone that is being editted.

How do I connect the insertListings to only show the rules associated with the id of the form?

Any help will be appreciated.

magento2 – Magento 2 set product image role programmatically

Hello and this is my code:

$imgURL = 'path/to/my/image.png';
$fileSystem = $objectManager->create('MagentoFrameworkFilesystem');
$mediaPath = $fileSystem->getDirectoryRead(MagentoFrameworkAppFilesystemDirectoryList::MEDIA)->getAbsolutePath();

$product->addImageToMediaGallery($mediaPath.'catalog/product'.$data('thumbnail_image'),('thumbnail', 'swatch'), false, false);

What I want to achive, is to assign programmatically and image and set it as a thumbnail.
The above code, uploads the image, but it’s role: the thumbnail and swatch are not selected. Not sure why ? See img:
enter image description here

Can you tell me what am i doing wrong ? thank you