Skip to main content
added 1248 characters in body
Source Link

Please make the below code change and try if it helps!

public function aroundPlaceOrder(QuoteManagement $subject, callable $proceed, $cartId, $payment = null)
    { 

        $quote = $this->quoteRepository->getActive($cartId);
        $paymentMethod = $quote->getPayment()->getMethod();
        $billingAddress = $quote->getBillingAddress()->getData();
        $shippingAddress = $quote->getShippingAddress()->getData();

        ......
        ......

        foreach($quote->getAllItems() as $item) {

            // Split Quote
            $split = $this->quoteFactory->create();
            $split->setCustomer($quote->getCustomer());
            
            // Save split to get a quote id for each item
            $this->quoteRepository->save($split);

            // Add item
            $item->setId(null);
            $split->addItem($item);

            // Set addresses
            $split->getBillingAddress()->setData($billingAddress);
            $split->getShippingAddress()->setData($shippingAddress);

            // Set payment menthod
            $split->getPayment()->setMethod($paymentMethod);

            ......
            ......
            
        }

    }

OR

Please set the Allow Anonymous Guest Access setting to "Yes and check if it works! Admin > Stores > Settings > Configuration > Services > Magento Web API > Web API Security.

More, check for user role and authentication token. Or maybe the session (auth token) expires. https://devdocs.magento.com/guides/v2.3/get-started/authentication/gs-authentication-token.html

Also, it could be an issue with the PHP version as well. Please visit the post here.

Please set the Allow Anonymous Guest Access setting to "Yes and check if it works! Admin > Stores > Settings > Configuration > Services > Magento Web API > Web API Security.

More, check for user role and authentication token. Or maybe the session (auth token) expires. https://devdocs.magento.com/guides/v2.3/get-started/authentication/gs-authentication-token.html

Also, it could be an issue with the PHP version as well. Please visit the post here.

Please make the below code change and try if it helps!

public function aroundPlaceOrder(QuoteManagement $subject, callable $proceed, $cartId, $payment = null)
    { 

        $quote = $this->quoteRepository->getActive($cartId);
        $paymentMethod = $quote->getPayment()->getMethod();
        $billingAddress = $quote->getBillingAddress()->getData();
        $shippingAddress = $quote->getShippingAddress()->getData();

        ......
        ......

        foreach($quote->getAllItems() as $item) {

            // Split Quote
            $split = $this->quoteFactory->create();
            $split->setCustomer($quote->getCustomer());
            
            // Save split to get a quote id for each item
            $this->quoteRepository->save($split);

            // Add item
            $item->setId(null);
            $split->addItem($item);

            // Set addresses
            $split->getBillingAddress()->setData($billingAddress);
            $split->getShippingAddress()->setData($shippingAddress);

            // Set payment menthod
            $split->getPayment()->setMethod($paymentMethod);

            ......
            ......
            
        }

    }

OR

Please set the Allow Anonymous Guest Access setting to "Yes and check if it works! Admin > Stores > Settings > Configuration > Services > Magento Web API > Web API Security.

More, check for user role and authentication token. Or maybe the session (auth token) expires. https://devdocs.magento.com/guides/v2.3/get-started/authentication/gs-authentication-token.html

Also, it could be an issue with the PHP version as well. Please visit the post here.

Source Link

Please set the Allow Anonymous Guest Access setting to "Yes and check if it works! Admin > Stores > Settings > Configuration > Services > Magento Web API > Web API Security.

More, check for user role and authentication token. Or maybe the session (auth token) expires. https://devdocs.magento.com/guides/v2.3/get-started/authentication/gs-authentication-token.html

Also, it could be an issue with the PHP version as well. Please visit the post here.