How to fix PHP ArgumentCountError: array_merge() does not accept unknown named parameters?

Recently I have faced an issue in the project while upgrading PHP version 7.* to 8.* and also upgrade composer version 1 from composer 2.

When I checked the pages in the latest version of PHP that used the array_merge(…$this->items) function in PHP 7.4, I got an error like given,

ArgumentCountError: array_merge() does not accept unknown named parameters in Items.php class.

Continue reading “How to fix PHP ArgumentCountError: array_merge() does not accept unknown named parameters?”

How to remove specific item from cart Magento 2?

You can delete specific quote items from the cart by quote id and item id in Magento 2.

With the help of Cart Item Interface, Magento\Quote\Api\CartItemRepositoryInterface you can use the deleteById() method.

Prerequisite to delete quote item:

          • Quote ID
          • Quote Item ID

Continue reading “How to remove specific item from cart Magento 2?”

How to create product attribute with select type by REST API Magento 2?

Create Product attribute with select (drop-down) option type by REST Web API Magento 2.
You can create a product select type attribute with the provided payload and basic operation.

Action: POST

Request URL: <HOST_URL>/rest/V1/products/attributes (https://magento.test/rest/V1/products/attributes)

Header: Authorization:Bearer <admin_user_token> Continue reading “How to create product attribute with select type by REST API Magento 2?”