Skip to main content

A Django E-commerce app for streamlined online retail, featuring product management, order processing, and flexible settings for discounts and stock tracking.

Project description

Django E-commerce

This Django E-commerce app empowers online retail businesses with robust features for managing products, categories, and orders. It includes versatile functionalities such as discount management, stock tracking, and flexible settings configuration to streamline the end-to-end E-commerce process.

Installation

  • Install this package using pip
pip install django-ecommerce
  • Add django_ecommerce to your INSTALLED_APPS setting like this
INSTALLED_APPS = [
    ...,
    "django_ecommerce",
]
  • Migrate your database
python manage.py migrate

Configuration

In the Django settings file, customize the available currencies for your E-commerce platform by modifying the ECOMMERCE_AVAILABLE_CURRENCIES list. Set the default currency using the ECOMMERCE_DEFAULT_CURRENCY variable, and tailor the displayed fields in the shipping administration interface with the ECOMMERCE_SHIPPING_ADMIN_FIELDS.

ECOMMERCE_AVAILABLE_CURRENCIES = [
    ('EUR', 'EUR'),
    ('USD', 'USD'),
]
ECOMMERCE_DEFAULT_CURRENCY = 'EUR'
ECOMMERCE_SHIPPING_ADMIN_FIELDS = ['full_name', 'address', 'phone', 'city', 'shipping_amount', 'remark']

Usage

To seamlessly integrate an ecommerce system into your Django application, it is recommended to leverage the utility functions provided by django_ecommerce.utils. These functions, including adding to cart, removing from cart, and creating orders, offer a convenient and robust solution for managing various ecommerce interactions within your application.

Here is a list of utility functions from django_ecommerce.utils with concise explanations for each

  • chunks(queryset, chunk_size)

    • Divides a given queryset into smaller chunks for more efficient processing.
  • similar_products(product, limit=4)

    • Finds and returns a specified number of products similar to the given product, excluding the original.
  • variant_availability(variant: ProductVariant, request) -> int

    • Determines the availability of a product variant by subtracting the quantity in the user's cart from the total available quantity.
  • money(amount: float, currency: str = None) -> Money

    • Generates a Money instance with the specified amount and currency. Uses the default currency from Django settings if available.
  • get_shipping_data(amount: Money) -> dict

    • Retrieves shipping-related data based on the total order amount, considering factors like free shipping eligibility and shipping cost.
  • get_cart(request)

    • Retrieves information about the user's shopping cart, including items, total cost, quantity, and shipping details.
  • remove_from_cart(request, variant_id: int) -> dict

    • Removes a specified product variant from the user's shopping cart.
  • add_to_cart(request, variant_id: int, quantity: int = 1) -> dict

    • Adds a specified quantity of a product variant to the user's shopping cart, considering stock availability.
  • create_order(request, email: str = None, full_name: str = None, ...) -> dict

    • Creates an order based on the user's shopping cart and specified details, including customer information and a custom callback function.
  • get_cities() -> set

    • Retrieves a set of city names from the database.
  • get_countries() -> set

    • Retrieves a set of country names from the database.
  • find_product_by_slug(slug: str) -> Product | None

    • Finds and returns a product based on its slug. Returns None if the product does not exist.
  • find_category_by_slug(slug: str) -> Category | None

    • Finds and returns a category based on its slug. Returns None if the category does not exist.
  • find_order_by_code(code: str) -> Order | None

    • Finds and returns an order based on its unique code. Returns None if the order does not exist.

Release Notes and Upgrade Guides

Project release documents live in docs/releases/ and use numeric prefixes for ordering.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_ecommerce-1.0.14.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_ecommerce-1.0.14-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file django_ecommerce-1.0.14.tar.gz.

File metadata

  • Download URL: django_ecommerce-1.0.14.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_ecommerce-1.0.14.tar.gz
Algorithm Hash digest
SHA256 bca605f1263c27b6585f0b12b3a9974a14429dc4453e8b854aa5480ef74ff110
MD5 3b40da84f5659c1bf488ad6337e0f4a5
BLAKE2b-256 faa039e408773d60c6e981f6d9d7f87e2e7317c33e481a6fffa95c10cc3a40f3

See more details on using hashes here.

File details

Details for the file django_ecommerce-1.0.14-py3-none-any.whl.

File metadata

File hashes

Hashes for django_ecommerce-1.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 ca6df713163bd921d4847765c976cc29497cf6666acb926e69a6e773537e5701
MD5 6a4ca0deb3b439f1af7936703054d944
BLAKE2b-256 48b89739f125dcf7be18c6a59b57cd4bae488ea93730bccdd08fe291ba5c56a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page