Skip to content

Magento 2.4.6 – Set the sort of the attributes in a programmatically created configurable product by setUsedProductAttributeIds()

I’m successfully import from a CSV file a massive number of SIMPLE products. Than I created the CONFIGURABLE products and assigned the simples by $configurableproduct_load->setCanSaveConfigurableAttributes(true); $configurableproduct_load->getTypeInstance()->setUsedProductAttributeIds(array(258,267,178), $configurableproduct_load); $configurableAttributesData = $configurableproduct_load->getTypeInstance()->getConfigurableAttributesAsArray($configurableproduct_load); $configurableproduct_load->setConfigurableAttributesData($configurableAttributesData); $configurableproduct_load->setAssociatedProductIds($associatedProductIds); $configurableproduct_load->save(); where 258, 267, 178 are the attributes… Read More »Magento 2.4.6 – Set the sort of the attributes in a programmatically created configurable product by setUsedProductAttributeIds()

sales_order_item_cancel Event Not Triggered when Canceling Order Programmatically using $this->orderManagement->cancel($orderId);

I’m currently working on a module that involves the programmatic cancellation of orders. To cancel orders, I am using $this->orderManagement->cancel($orderId); in my code. This appears to be working correctly as the order status and state change to ‘canceled’ and the… Read More »sales_order_item_cancel Event Not Triggered when Canceling Order Programmatically using $this->orderManagement->cancel($orderId);