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.”

How to Get/Create Customer Active Quote Id by V1/carts/mine REST API Magento 2?

Magento Create an empty cart for login customer by REST API, You need to first fetch the current customer active quote id by V1/carts/mine endpoint.

By using given endpoint, You will get the current customer quote id with a simple API and if the customer doesn’t have any active cart, it will create an empty cart with the use of API.

Action: POST

Header: Authorization: Bearer <CUSTOMER_TOKEN> 
You can check the link to Generate Customer Token by Rest API.

URL: https://magento.test/rest/V1/carts/mine

Payload: null

Response: Quote ID. (Example: 12 Here 12 is the quote id for the customer.)

The response of the API will be helpful to add items to the cart for the login customer with Rest API.