Skip to main content

Magento2

Power your online business with the most flexible and scalable ecommerce platform

Magento2 - Get Quote Id from hashed graphql ID

In this wiki, we will write the code to get the entity id from hashed id for Magento2 Quote

protected $maskedQuoteIdToQuoteId;
public function __construct(
       \Magento\Quote\Model\MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdToQuoteId
   ) {
       $this->maskedQuoteIdToQuoteId = $maskedQuoteIdToQuoteId;
   }

then you can call execute function


$cartHash = "6zIMBpw1NSixrw8BpUzIMHOvAR9ZopYW";
$cartId = $this->maskedQuoteIdToQuoteId>execute($cartHash);

 

 

Magento 2 optimize the queue consumers

If you're experiencing issues with Magento 2 cron jobs getting stuck or running for a long time, there are ways to optimize how Magento handles the queue consumers.

By default, consumers will keep polling for messages as long as the number of processed messages is less than the max_messages value, which can be specified in the env.php file. However, this approach is typically recommended for larger merchants where a constant flow of messages is expected.