Skip to content

Drupal Commerce 2.x contrib module. Provides a service for bulk creation of Drupal Commerce entities.

Notifications You must be signed in to change notification settings

drugan/commerce_bulk

Repository files navigation

Commerce Bulk

Provides a service for bulk creation of Drupal Commerce entities such as attribute values and variations. Also, products can be bulk generated if the Commerce Generate ↗ submodule is enabled.

Tip: you can see this file in your browser by clicking the admin/help# link at the right of the Admin toolbar and then the admin/help/commerce_bulk# link in the list.



Bulk variation actions

After installing the module go to a product/1/variations# tab and manage your variations using configurable variation actions which are self-explanatory and easy to use. Other contrib modules can add their own actions.

Variation Bulk Operations


To set up an auto SKU pattern used for **Duplicate variation** action just press the **Add variation** button and then click on the admin/commerce/config/product-variation-types/default/edit/form-display# link in the SKU field description.

SKU widget

The SKU widget settings' summary explained:

  • size: The size of the SKU field on a variation add / edit form.
  • placeholder: The text appearing inside the empty SKU field.
  • maximum: The maximum of SKU values that might be generated in one go. Use it to restrict the number of variations to create by pressing the Create N variations button. So, to create the next portion of variations the button should be pressed once more and more, etc..
  • custom_label: Set a custom label for the field as the default "SKU" text for the label might be seen as confusing by some people.
  • hide: Whether to hide the SKU field on a variation add / edit form. Note that, despite the field is not visible, a valid SKU value will be generated on the backend for the field.
  • prefix: The text automatically prepended to a SKU value.
  • suffix: The text automatically appended to a SKU value.
  • auto SKU sample: The sample of the unique SKU ↗ that will be generated for the given product variation type.

Bulk attribute actions

Press an attribute **Bulk** operation button while on the admin/commerce/product-attributes# page.

Attributes Bulk Operations


Bulk taxonomy term actions

Press an attribute **Bulk** operation button while on the admin/structure/taxonomy# page.

Taxonomy Term Bulk Operations


Manage an attribute values using configurable actions which are self-explanatory and easy to use. Other contrib modules can add their own actions.

Attribute Bulk Operations


Anonymize Orders

Select orders to anonymize on the admin/commerce/orders# page and then select desirable fields on the action config form.

Anonymize Order

See an example how orders or any other entity type can be anonymized on a cron job:

@PHPFILE: commerce_bulk.module LINE:182 PADD:22 :PHPFILE@


Info for developers

All the above functionality is based on the **BulkVariationsCreator** service which you can use in your custom module. For example, let's say you want to automatically create products with all possible or just a subset of variations. It's easy, just see how the Commerce Generate GenerateProducts plugin make it.

@PHPFILE: modules/commerce_generate/src/Plugin/DevelGenerate/GenerateProducts.php LINE:576 PADD:18 :PHPFILE@


Also, see how the service is called in the commerce_bulk.module file.

@PHPFILE: commerce_bulk.module LINE:92 PADD:5 :PHPFILE@


TODO

  • Apply mechanism to automatically add variation images based on a certain criteria.
  • Create variations in a batch process. Example ↗
Module author:
  Vlad Proshin (drugan)
  [proshins@gmail.com](proshins@gmail.com)
  [https://drupal.org/u/drugan](https://drupal.org/u/drugan)

About

Drupal Commerce 2.x contrib module. Provides a service for bulk creation of Drupal Commerce entities.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages