Skip to content

Magento overrule Magento/Sales/Model/Order/ShipmentFactory.php

I trie to overrule Magento/Sales/Model/Order/ShipmentFactory.php and i have code below, but i get error: main.CRITICAL: ReflectionException: Class “JilcoShipmentbugModelOrderShipmentFactory” does not exist in /home/jilco/public_html/vendor/magento/framework/Code/Reader/ClassReader.php:34 registration.php <?php use MagentoFrameworkComponentComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, ‘Jilco_Shipmentbug’, __DIR__); DI.xml <?xml version=”1.0″?> <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:ObjectManager/etc/config.xsd”> <preference for=”MagentoSalesModelOrderShipmentFactory” type=”JilcoShipmentbugModelOrderShipmentFactory” />… Read More »Magento overrule Magento/Sales/Model/Order/ShipmentFactory.php

How to programmatically assign simple product to configurable on Magento 2.4

How do you programmatically assign simple product to configurable? What I tried: $configurableProduct = $this->objectManager->create(‘MagentoConfigurableProductModelProductTypeConfigurable’); $configurableProduct->setUsedProductAttributes($product, array($product_jsa_type_attribute_id)); $product->setNewVariationsAttributeSetId(4); $product->setAssociatedProductIds(array( $productObj->getIdBySku($ticketProduct[‘product_id’]), $productObj->getIdBySku($couponProduct[‘product_id’]), ));