Skip to content

netzstrategen/wordpress-shop-standards

Repository files navigation

Shop Standards plugin

This plugin adds what we consider standard refinements for e-commerce websites. These refinements include diverse customizations to WooCommerce and related plugins, like WooCommerce German Market.

Configuration settings

The plugin adds several configuration settings in two main points of the backend admin:

Shop customizations

The customizations applied by shop-standards affect diverse aspects of the way the shop works: products prices, products stocks, products delivery time, products listing filtering, SEO, performance, WP-CLI commands...

WooCommerce customizations

These customizations include:

General products management and display

Product backend custom fields

The plugin adds several backend custom fields to both simple products(#1, #2, #3) and variable products(#1, #2).

Custom fields added to products are:

  • Simple products
    • Back in stock date
    • GTIN
    • ERP/Inventory ID
    • Display sale price as normal price (checkbox)
    • Product notes
    • Custom price label
    • Hide sale percentage bubble (checkbox)
    • Hide add to cart button (checkbox)
    • Variation has insufficient images (checkbox, only product variations)
    • Purchasing Price
    • Price comparison focus product

Products prices

Customizations in the way the product prices are managed and displayed include:

Products sale label and category

Products on sale can be automatically assigned a custom category. This is implemented in class WooCommerceSaleLabel.

Products stocks

Products delivery time management and display

This feature relies on a very specific way to setup the delivery time values. Those need to be defined as terms of taxonomy product_delivery_times.

The slug of each term in the taxonomy has to be a numeric value, so that the code is able to compare all values and select the lowest one. The recommended way is to set the slug of each term to the value in days of the corresponding delivery time. If the delivery time is a range, we pick the highest time.

E.g.

  • ca. 2-3 Wochen => 21
  • ca. 5-6 Wochen => 40
  • ca. 3-4 Werktage => 4
  • 48 stunden => 2

Filtering products by delivery time

This plugin adds a widget to filter products by their delivery time. This is achieved overriding layered nav WooCommerce widgets with new ones supporting WooCommerce German Market delivery time taxonomy terms (see previous point) to be used as product filters.

The whole implementation is contained in folder src/ProductFilters, entry point being class DeliveryTime.

The time delivery product filter widget can be used in any products listing page, as any other WooCommerce (so called) layered navigation widget.

Cart and checkout

Order emails

Performance improvements

Performance improvements are mainly implemented in class Performance. Those cover:

Customizations on third party plugins

WooCommerce German Market

B2B Market

WP-CLI custom commands

Plugin shop-standards provide a custom WP-CLI command to update the delivery time of variable products. This command ensures the delivery time assigned to variable products is the lowest among its variations.

Although this update is triggered whenever the variable products are edited and saved, this offers a convenient way to update a given variable product (by ID), a list of them (comma separated list of IDs) or all of them.

Update delivery time for a single product:

wp shop-standards refreshDeliveryTime 2165

Update delivery time for a list of products:

wp shop-standards refreshDeliveryTime 2165, 2166, 2167

Update delivery time for all products:

wp shop-standards refreshDeliveryTime --all