Skip to content

Instantly share code, notes, and snippets.

@lisastreeter
lisastreeter / GaltOrderItemProduct.php
Created November 16, 2017 01:18
Limit by product commerce condition plugin with add another
<?php
namespace Drupal\galt\Plugin\Commerce\Condition;
use Drupal\commerce\Plugin\Commerce\Condition\ConditionBase;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
@lisastreeter
lisastreeter / migrate_plus.migration.product_shipping.yml
Created January 14, 2018 15:48
Drupal 8 migration embedded_data source plugin for product specification migration
dependencies:
enforced:
module:
- wbconline_migrate
id: product_shipping
label: 'Create product shipping conditions taxonomy terms'
migration_group: wbconline
@lisastreeter
lisastreeter / migrate_plus.migration.commerce_store.yml
Created January 24, 2018 17:29
Example of embedded data source plugin for migration of Drupal Commerce stores
langcode: en
status: true
dependencies:
enforced:
module:
- wbconline_migrate
id: commerce_store
migration_tags: null
migration_group: wbconline
label: 'Create default commerce store'
@lisastreeter
lisastreeter / ProductInventorySizeBasisWidget.php
Last active January 26, 2018 16:42
Custom entity reference field widget for inventory size basis product field
<?php
namespace Drupal\wbc_custom\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget;
/**
@lisastreeter
lisastreeter / OrderItemDiscountToFixed.php
Created February 28, 2018 16:35
Offer type example for Commerce documentation
<?php
namespace Drupal\my_module\Plugin\Commerce\PromotionOffer;
use Drupal\commerce_order\Adjustment;
use Drupal\commerce_price\Price;
use Drupal\commerce_promotion\Entity\PromotionInterface;
use Drupal\commerce_promotion\Plugin\Commerce\PromotionOffer\PromotionOfferBase;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;