Skip to main content

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.

Metadata

Release files for django-ecommerce 1.0.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-ecommerce 1.0.18
File Size Uploaded Provenance Actions
django_ecommerce-1.0.18.tar.gz 28.6 kB Without provenance Details for django_ecommerce-1.0.18.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-ecommerce 1.0.18
File Interpreter ABI Platform Actions
django_ecommerce-1.0.18-py3-none-any.whl Python 3 none any Details for django_ecommerce-1.0.18-py3-none-any.whl

Total release size: 63.9 kB

Release files / django_ecommerce-1.0.18.tar.gz

Download URL django_ecommerce-1.0.18.tar.gz
Size 28.6 kB
Tags Source
SHA-256 checksum
How to use checksums
24c063369b6f84e82dd72dc976edc416b1df4077239b0621681638076393ca9b
BLAKE2b-256 checksum
How to use checksums
681435e196b2b389270593c34c57fe5693fb762f40d9c7035a77840e6389d2fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Release files / django_ecommerce-1.0.18-py3-none-any.whl

Download URL django_ecommerce-1.0.18-py3-none-any.whl
Size 35.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85fb7f86d71109537a24ac106c6918d32943684a8900b5cfc6445539a0c969a6
BLAKE2b-256 checksum
How to use checksums
3bcf0a1646b5259e15790f02faad71ace8ac115505dd975828f78d88fff2b098
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.13

Security for django-ecommerce 1.0.18

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page