GraphQl Create Empty cart for registered customer Magento 2.

To Create an Empty cart for a logged-in customer by GraphQl in Magento, you need to use Mutation to generate a cart id.

The Response of the createEmptyCart GraphQl mutation used for the add item to the customer cart by passing cart Id in addProductsToCart Mutation. Continue reading “GraphQl Create Empty cart for registered customer Magento 2.”

How to add Magento 2 Docker phpmyadmin image in docker-compose.yml file?

You can add the PHPMyAdmin image snippet in the docker-compose YAML file that looks like below code snippet.

In Docker instance,

version: '3.0'
services:
  phpmyadmin:
    image: 'phpmyadmin/phpmyadmin:latest'
    environment:
      - PMA_HOST=<hostname>
      - PMA_USER=<db_user>
      - PMA_PASSWORD=<password>
    ports:
      - "8080:80"
    volumes:
      - /sessions
    networks:
      magento:
        aliases:
          - 'phpmyadmin.magento2.docker'

Using this code, you can directly access the phpmyadmin database from the browser.

For Warden,

php-fpm:
    ports:
            - "4000:4000"
            - "3001:3001"
    phpmyadmin:
        restart: always
        image: docker.io/library/phpmyadmin:latest
        hostname: ${WARDEN_ENV_NAME}-phpmyadmin
        domainname: phpmyadmin.${WARDEN_ENV_NAME}.test
        ports:
            - 8100:80
        environment:
            - PMA_HOSTS=${WARDEN_ENV_NAME}_db_1
            - PMA_USER=magento
            - PMA_PASSWORD=magento
            - PMA_ABSOLUTE_URI=http://phpmyadmin.${TRAEFIK_DOMAIN}

Add item to cart for login customer by V1/carts/mine/items REST API Magento 2.

You can add any product type to the cart by REST API in Magento 2 using V1/carts/mine/items endpoint with a custom token as a Header parameter.

This API is useful when you add items to the cart with a third-party platform for the logged-in customer.

To run successfully with this API, you first need to generate a customer token that we have to pass to the Header parameter in the call request. Continue reading “Add item to cart for login customer by V1/carts/mine/items REST API Magento 2.”