/** * Append attributes to the list of attributes loaded on the quote_items collection * * @param QuoteConfig $config * @param $attributes * @return array */ public function afterGetProductAttributes(QuoteConfig $config, $attributes) { if ($this->config->getRef1Attribute()) { $attributes[] = $this->config->getRef1Attribute(); } if ($this->config->getRef2Attribute()) { $attributes[] = $this->config->getRef2Attribute(); } if ($this->config->getUpcAttribute()) { $attributes[] = $this->config->getUpcAttribute(); } return array_unique($attributes); }
/** * Get AvaTax ItemCode for product if UPC is configured and product contains UPC * * @param \Magento\Catalog\Model\Product $product * @return null|string */ public function getItemCodeOverride(\Magento\Catalog\Model\Product $product) { if ($this->config->getUpcAttribute() && $product->getData($this->config->getUpcAttribute())) { $upcCode = $product->getData($this->config->getUpcAttribute()); if ($upcCode) { return sprintf(self::UPC_FORMAT, $upcCode); } } return null; }