Drupal Commerce

Submitted by admin@soz on Mon, 04/13/2020 - 19:06

How to install drupal commerce (drupal 8)

  • Install drupal 8 + drupal commerce with composer
  • Working folder for composer: ..'root directory'/ (Example: C://Program File/Xampp/htdocs)
  • Using composer: composer create-project drupalcommerce/project-base mystore --stability dev
  • Enter then composer will install drupal 8 + drupal commerce
  • After that install the site by click the folder: 'mystore'/web
  • Give the database & password (if have password)
  • ..and proceed as regular

Must use composer to update (always backup before update: 

  • To update Drupal Commerce and all contributed projects extending Drupal Commerce: composer update --with-dependencies "drupal/commerce*"
  • If you want to only upgrade Drupal Commerce, run this command: composer update --with-dependencies drupal/commerce drupal/commerce_price drupal/commerce_product drupal/commerce_order drupal/commerce_payment drupal/commerce_payment_example drupal/commerce_checkout drupal/commerce_tax drupal/commerce_cart drupal/commerce_log drupal/commerce_store drupal/commerce_promotion drupal/commerce_number_pattern
  • Once the Drupal.org infrastructure issue is resolved, the command will be: composer update drupal/commerce --with-dependencies

Run your Drupal updates once all of the dependencies are updated. Recommend running them on the command line rather than the update.php

drupal debug:update
drupal update:execute

Further Reading:

Let begin to create our first drupal commerce (source from docs.drupalcommerce.org)

Creata Store

  • Before create store, we need to have at least one currency
  • After that we can create store
    • Give the Name, Email, Default Currency, Address & Tax Setting 
  • Use cases:

    • One business that has one or more locations or
    • The marketplace model (where you have sellers) where you have many sellers who are taking payment for unique products

Create Product

  • Terminology:-
    • Attribute: Something about the product which creates a unique choice. For clothing this would be the color and size.
    • Variation: A product variation represents an option of specific attributes for a product. For example, the Large Blue sweatshirt versus the Medium Red sweatshirt
    • Product: The actual product, a sweatshirt, which contains all of its variations

Product attribute

  • For example we sell T-shirt - The color & size are product attribute while Blue and small are product attribute values