module-shipper icon indicating copy to clipboard operation
module-shipper copied to clipboard

Error with products that have custom options with sku

Open JeoffScott opened this issue 4 years ago • 5 comments

Environment Magento 2.4.3-p2 PHP 7.4 Module Version 20.49.0

Steps To Reproduce create simple product with custom option with sku add product to the cart go to checkout

Expected Result: shipping block is loaded correctly

Actual Result: TypeError: Argument 1 passed to Magento\InventoryConfiguration\Model\IsSourceItemManagementAllowedForProductType\Interceptor::execute() must be of the type string, null given, called in /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/module-inventory-sales/Model/GetProductSalableQty.php on line 108 and defined in /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/generated/code/Magento/InventoryConfiguration/Model/IsSourceItemManagementAllowedForProductType/Interceptor.php:20 Stack trace: #0 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/module-inventory-sales/Model/GetProductSalableQty.php(108): Magento\InventoryConfiguration\Model\IsSourceItemManagementAllowedForProductType\Interceptor->execute(NULL) #1 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/module-inventory-sales/Model/GetProductSalableQty.php(75): Magento\InventorySales\Model\GetProductSalableQty->validateProductType('***') #2 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/shipperhq/module-shipper/src/Model/Carrier/Processor/StockHandler.php(108): Magento\InventorySales\Model\GetProductSalableQty->execute('***', 1) #3 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/shipperhq/module-shipper/src/Model/Carrier/Processor/ShipperMapper.php(651): ShipperHQ\Shipper\Model\Carrier\Processor\StockHandler->getInventoryCount(Object(Magento\Quote\Model\Quote\Item), Object(Magento\Catalog\Model\Product\Interceptor)) #4 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/shipperhq/module-shipper/src/Model/Carrier/Processor/ShipperMapper.php(434): ShipperHQ\Shipper\Model\Carrier\Processor\ShipperMapper->getDefaultWarehouseStockDetail(Object(Magento\Quote\Model\Quote\Item)) #5 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/shipperhq/module-shipper/src/Model/Carrier/Processor/ShipperMapper.php(327): ShipperHQ\Shipper\Model\Carrier\Processor\ShipperMapper->getFormattedItems(Object(Magento\Quote\Model\Quote\Address\RateRequest), Array) #6 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/shipperhq/module-shipper/src/Model/Carrier/Processor/ShipperMapper.php(284): ShipperHQ\Shipper\Model\Carrier\Processor\ShipperMapper->getCartDetails(Object(Magento\Quote\Model\Quote\Address\RateRequest)) #7 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/shipperhq/module-shipper/src/Model/Carrier/Shipper.php(369): ShipperHQ\Shipper\Model\Carrier\Processor\ShipperMapper->getShipperTranslation(Object(Magento\Quote\Model\Quote\Address\RateRequest)) #8 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/shipperhq/module-shipper/src/Model/Carrier/Shipper.php(315): ShipperHQ\Shipper\Model\Carrier\Shipper->setRequest(Object(Magento\Quote\Model\Quote\Address\RateRequest)) #9 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/module-shipping/Model/Shipping.php(337): ShipperHQ\Shipper\Model\Carrier\Shipper->collectRates(Object(Magento\Quote\Model\Quote\Address\RateRequest)) #10 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Shipping\Model\Shipping->collectCarrierRates('shipper', Object(Magento\Quote\Model\Quote\Address\RateRequest)) #11 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Shipping\Model\Shipping\Interceptor->___callParent('collectCarrierR...', Array) #12 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/shipperhq/module-shipper/src/Plugin/Shipping/ShippingPlugin.php(123): Magento\Shipping\Model\Shipping\Interceptor->Magento\Framework\Interception\{closure}('shipper', Object(Magento\Quote\Model\Quote\Address\RateRequest)) #13 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/framework/Interception/Interceptor.php(135): ShipperHQ\Shipper\Plugin\Shipping\ShippingPlugin->aroundCollectCarrierRates(Object(Magento\Shipping\Model\Shipping\Interceptor), Object(Closure), 'shipper', Object(Magento\Quote\Model\Quote\Address\RateRequest)) #14 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Shipping\Model\Shipping\Interceptor->Magento\Framework\Interception\{closure}('shipper', Object(Magento\Quote\Model\Quote\Address\RateRequest)) #15 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/generated/code/Magento/Shipping/Model/Shipping/Interceptor.php(23): Magento\Shipping\Model\Shipping\Interceptor->___callPlugins('collectCarrierR...', Array, NULL) #16 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/module-shipping/Model/Shipping.php(244): Magento\Shipping\Model\Shipping\Interceptor->collectCarrierRates('shipper', Object(Magento\Quote\Model\Quote\Address\RateRequest)) #17 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/module-quote/Model/Quote/Address.php(1076): Magento\Shipping\Model\Shipping->collectRates(Object(Magento\Quote\Model\Quote\Address\RateRequest)) #18 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/module-quote/Model/Quote/Address.php(1003): Magento\Quote\Model\Quote\Address->requestShippingRates() #19 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/module-quote/Model/Quote/Address/Total/Shipping.php(83): Magento\Quote\Model\Quote\Address->collectShippingRates() #20 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/module-quote/Model/Quote/TotalsCollector.php(274): Magento\Quote\Model\Quote\Address\Total\Shipping->collect(Object(Magento\Quote\Model\Quote\Interceptor), Object(Magento\Quote\Model\ShippingAssignment), Object(Magento\Quote\Model\Quote\Address\Total)) #21 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/module-quote/Model/ShippingMethodManagement.php(322): Magento\Quote\Model\Quote\TotalsCollector->collectAddressTotals(Object(Magento\Quote\Model\Quote\Interceptor), Object(Magento\Quote\Model\Quote\Address\Interceptor)) #22 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/module-quote/Model/ShippingMethodManagement.php(258): Magento\Quote\Model\ShippingMethodManagement->getShippingMethods(Object(Magento\Quote\Model\Quote\Interceptor), Object(Magento\Quote\Model\Quote\Address\Interceptor)) #23 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Quote\Model\ShippingMethodManagement->estimateByExtendedAddress(83238, Object(Magento\Quote\Model\Quote\Address\Interceptor)) #24 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Quote\Model\ShippingMethodManagement\Interceptor->___callParent('estimateByExten...', Array) #25 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Quote\Model\ShippingMethodManagement\Interceptor->Magento\Framework\Interception\{closure}(83238, Object(Magento\Quote\Model\Quote\Address\Interceptor)) #26 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/generated/code/Magento/Quote/Model/ShippingMethodManagement/Interceptor.php(23): Magento\Quote\Model\ShippingMethodManagement\Interceptor->___callPlugins('estimateByExten...', Array, Array) #27 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/module-quote/Model/GuestCart/GuestShippingMethodManagement.php(103): Magento\Quote\Model\ShippingMethodManagement\Interceptor->estimateByExtendedAddress(83238, Object(Magento\Quote\Model\Quote\Address\Interceptor)) #28 [internal function]: Magento\Quote\Model\GuestCart\GuestShippingMethodManagement->estimateByExtendedAddress('171wK4nnI6wA4Yy...', Object(Magento\Quote\Model\Quote\Address\Interceptor)) #29 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array(Array, Array) #30 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/module-webapi/Controller/Rest.php(188): Magento\Webapi\Controller\Rest\SynchronousRequestProcessor->process(Object(Magento\Framework\Webapi\Rest\Request\Proxy)) #31 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http)) #32 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent('dispatch', Array) #33 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http)) #34 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(23): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins('dispatch', Array, Array) #35 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/framework/App/Http.php(116): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http)) #36 /srv/releases/d702c283ab50f3242b76785f4f389aaf75020b21/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http->launch() #37 /srv/releases/d702c28

Note Fix

=================================================================== diff --git a/vendor/shipperhq/module-shipper/src/Model/Carrier/Processor/StockHandler.php b/vendor/shipperhq/module-shipper/src/Model/Carrier/Processor/StockHandler.php --- a/vendor/shipperhq/module-shipper/src/Model/Carrier/Processor/StockHandler.php +++ b/vendor/shipperhq/module-shipper/src/Model/Carrier/Processor/StockHandler.php (date 1657038107399) @@ -83,13 +83,13 @@ public function getInstock($item, $product) { $stockId = $this->getStockIdForCurrentWebsite->execute();

  •    $stockItemConfiguration = $this->getStockItemConfiguration->execute($product->getSku(), $stockId);
    
  •    $stockItemConfiguration = $this->getStockItemConfiguration->execute($product->getData('sku'), $stockId);
       $isManageStock = $stockItemConfiguration->isManageStock();
       if (!$isManageStock) {
           return true;
       }
    
  •    $productSalableQty = $this->getProductSalableQty->execute($product->getSku(), $stockId);
    
  •    $productSalableQty = $this->getProductSalableQty->execute($product->getData('sku'), $stockId);
    
       $inStock = $productSalableQty !== null ? $productSalableQty >= $item->getQty() : true;
       return $inStock;
    

@@ -99,13 +99,13 @@ {

     $stockId = $this->getStockIdForCurrentWebsite->execute();
  •    $stockItemConfiguration = $this->getStockItemConfiguration->execute($product->getSku(), $stockId);
    
  •    $stockItemConfiguration = $this->getStockItemConfiguration->execute($product->getData('sku'), $stockId);
       $isManageStock = $stockItemConfiguration->isManageStock();
       if (!$isManageStock) {
           return null;
       }
    
  •    $productSalableQty = $this->getProductSalableQty->execute($product->getSku(), $stockId);
    
  •    $productSalableQty = $this->getProductSalableQty->execute($product->getData('sku'), $stockId);
    
       return $productSalableQty;
    

JeoffScott avatar Jul 05 '22 16:07 JeoffScott

Thanks for the headsup @JeoffScott ! We're looking into this and we'll get back to you soon!

ibraheemnabeelfauzi avatar Jul 05 '22 22:07 ibraheemnabeelfauzi

Hi @JeoffScott Can you confirm if there are any changes to the inventory modules in the store? This was tested on a fresh install of Magento 2.4.3-p1 with PHP 7.4 and the latest ShipperHQ modules. This was tested by adding custom options to an existing product and creating a new product with custom options. All tests were successful.

wsajason avatar Jul 06 '22 11:07 wsajason

Hi @wsajason Did you setted this data? image

JeoffScott avatar Jul 06 '22 13:07 JeoffScott

Thank you for confirming. This has been passed to our developers for further analysis.

wsajason avatar Jul 06 '22 13:07 wsajason

@JeoffScott we've released a new version of the ext that addresses this. Please upgrade to the latest and you'll be solid to go.

Thanks!

ibraheemnabeelfauzi avatar Jul 15 '22 13:07 ibraheemnabeelfauzi