How to remove a specific key from Javascript Object?

In Javascript, You can remove/delete key-value pairs from the Object easily.

Just use, delete keywords with object.keyname or object['keyname']. delete used for removing a object key from given objects in Javascript.

Let’s take a simple object,

let xyz = {};
xyz.first = 1;
xyz.second = 2;
xyz.third = 3;
xyz.forth = 4;

Run console.log(xyz); Continue reading “How to remove a specific key from Javascript Object?”

How to set search engine robots meta tag content value in Magento 2?

You can set search engine meta tag robots content value from the Magento admin panel.

Just Log in with the Admin panel,

      • Go To Content -> Design -> Configuration,
        Edit your Theme,
      • From the Other Settings Section,
      • Click on Search Engine Robots,
      • Choose the value from Default Robots,
      • Save Configuration.

Continue reading “How to set search engine robots meta tag content value in Magento 2?”

How to apply SortOrder on Search Criteria Repositories Magento 2?

Magento apply sort order for the search criteria interface repository by using Magento\Framework\Api\SortOrderBuilder Class.

You can do sorting by ASC or DESC order by any field type for a given search criteria repository.

$sortOrder = $this->sortOrderBuilder
            ->setField('created_at')  //FIELD_NAME
            ->setDirection(SortOrder::SORT_DESC) // SORT_TYPE
            ->create();

You can check the given code snippet to fetch orders by created date with the search criteria builder order repository. Continue reading “How to apply SortOrder on Search Criteria Repositories Magento 2?”