Need to update Shipping title in Magento2's Observer Ask Question

I am working on a project in which have to change Shipping title from 2nd Day Air to 2nd Day Air (Delivered on 10th July).

I have a observer which is triggered by an event.

Added some function to update the title and it shows in response (checked in firebug)

I am using following lines to update and save Quote

$quoteData      = $this->_checkoutSession->getQuote();
$quoteId        = $quoteData->getId();
$shippingTitle  = $quoteData->getShippingAddress()->getShippingDescription();
$newTitle       = $this->_shippingEstimation->getRateTitle($shippingTitle); // update shipping title
$quoteData->getShippingAddress()->setShippingDescription($newTitle);        
$quoteData->getShippingAddress()->setShippingTitle($newTitle); 
$quoteData->save();

I have tried with setShippingDescription and setShippingTitle but after placing order admin view and in email its not updated.

Any clue that I am not good correctly or need to change ?

Magento 2 Multi-Store Urls Ask Question

I’m creating a Magento 2.2.5 ecommerce website consisting of three Magento stores, plus the main site to direct customers to the most appropriate Magento Store.

I have configured the Stores and Store Views under the one Website within Magento 2 but can’t find a way to access the sites directly through the front end. Have also tried modifying each store config for Base URL with no success.

What is the valid url to the individual Stores. Do I need to modify index.php and .htaccess to get it working (there are posts that say yes but don’t seem to work)? Should it work from just the Magento store config?

Advice appreciated.
Ben

Magento2 Plugin class Path not found Ask Question

I have created a plugin for Magento2 to remove the Parent Category Path, but getting the error like:

  Fatal error: Uncaught Error: Class 
'MywebRemoveParentCategoryPathPluginPluginCategory' not found in 

/public_html/app/code/Myweb/RemoveParentCategoryPathPlugin/Plugin/RemoveParentCategoryPathPlugin.php:8 Stack trace: #0 

/public_html/vendor/magento/framework/Interception/Interceptor.php(135):

 MywebRemoveParentCategoryPathPluginPluginRemoveParentCategoryPathPlugin->aroundGetUrlPath(Object(MagentoCatalogUrlRewriteModelCategoryUrlPathGeneratorInterceptor),
 Object(Closure), Object(MGSMpanelModelCategoryInterceptor)) #1 

/public_html/vendor/magento/framework/Interception/Interceptor.php(153): 

MagentoCatalogUrlRewriteModelCategoryUrlPathGeneratorInterceptor->MagentoFrameworkInterception{closure}

(Object(MGSMpanelModelCategoryInterceptor)) #2 

/public_html/generated/code/Magento/CatalogUrlRewrite/Model/CategoryUrlPathGenerator/Interceptor.php(26): 

MagentoCatalogUrlRewriteModelCategoryUrlPathGeneratorInterceptor->___cal in /public_html/app/code/Myweb/RemoveParentCategoryPathPlugin/Plugin/RemoveParentCategoryPathPlugin.php on line 8

My plugin module files are like this:

app/code/Myweb/RemoveParentCategoryPathPlugin/Plugin/RemoveParentCategoryPathPlugin.php

<?php
namespace MywebRemoveParentCategoryPathPluginPlugin;

class RemoveParentCategoryPathPlugin
{
    public function aroundGetUrlPath($subject, $proceed, $category)
    {
        if (in_array($category->getParentId(), [Category::ROOT_CATEGORY_ID, Category::TREE_ROOT_ID])) {
            return '';
        }
        $path = $category->getUrlPath();
        if ($path !== null && !$category->dataHasChangedFor('url_key') && !$category->dataHasChangedFor('parent_id')) {
            return $path;
        }
        $path = $category->getUrlKey();
        if ($path === false) {
            return $category->getUrlPath();
        }
        return $path;
    }
}

app/code/Myweb/RemoveParentCategoryPathPlugin/etc/di.xml contents are

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="MagentoCatalogUrlRewriteModelCategoryUrlPathGenerator">
        <plugin name="Myweb_RemoveParentCategoryPathPlugin" type="MywebRemoveParentCategoryPathPluginPluginRemoveParentCategoryPathPlugin" />
    </type>
</config>

app/code/Myweb/RemoveParentCategoryPathPlugin/etc/module.xml contents are

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Myweb_RemoveParentCategoryPathPlugin" setup_version="1.0.5" />
</config>

app/code/Myweb/RemoveParentCategoryPathPlugin/registration.php contents are

<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Myweb_RemoveParentCategoryPathPlugin',
__DIR__
);

I am struggling the find, what I have missed.