Install Avalara + Shipment

Edit on GitHub

To enable the Avalara + Shipment component of the Avalara partner integration, use the spryker-eco/avalara-tax-shipment module.

Install feature core

Follow the steps below to install the feature core.

Prerequisites

Install the necessary features:

NAME VERSION INSTALLATION GUIDE
Shipment master Install the Shipment feature
Avalara Tax master Avalara Tax integration

Install the required modules

Install the required modules using Composer:

composer require spryker-eco/avalara-tax-shipment:"^0.1.0" --update-with-dependencies
Verification

Make sure that the following modules have been installed:

MODULE EXPECTED DIRECTORY
AvalaraTaxShipment vendor/spryker-eco/avalara-tax-shipment

Set up database schema

Apply database changes, generate entity and transfer changes:

console propel:install
console transfer:generate
Verification

Make sure that the following changes have been applied by checking your database:

DATABASE ENTITY TYPE EVENT
spy_shipment_method.avalara_tax_code column created

Set up behavior

  1. Activate the following plugins:
PLUGIN SPECIFICATION PREREQUISITES NAMESPACE
AvalaraShipmentCreateTransactionRequestExpanderPlugin Expands AvalaraCreateTransactionRequestTransfer with shipments. SprykerEco\Zed\AvalaraTaxShipment\Communication\Plugin\AvalaraTax
AvalaraShipmentCreateTransactionRequestAfterPlugin Calculates taxes for shipment methods based on AvalaraCreateTransactionResponseTransfer. SprykerEco\Zed\AvalaraTaxShipment\Communication\Plugin\AvalaraTax

src/Pyz/Zed/AvalaraTax/AvalaraTaxDependencyProvider.php

<?php

namespace Pyz\Zed\AvalaraTax;

use SprykerEco\Zed\AvalaraTax\AvalaraTaxDependencyProvider as SprykerAvalaraTaxDependencyProvider;
use SprykerEco\Zed\AvalaraTaxShipment\Communication\Plugin\AvalaraTax\AvalaraShipmentCreateTransactionRequestAfterPlugin;
use SprykerEco\Zed\AvalaraTaxShipment\Communication\Plugin\AvalaraTax\AvalaraShipmentCreateTransactionRequestExpanderPlugin;

class AvalaraTaxDependencyProvider extends SprykerAvalaraTaxDependencyProvider
{
    /**
     * @return \SprykerEco\Zed\AvalaraTaxExtension\Dependency\Plugin\CreateTransactionRequestExpanderPluginInterface[]
     */
    protected function getCreateTransactionRequestExpanderPlugins(): array
    {
        return [
            new AvalaraShipmentCreateTransactionRequestExpanderPlugin(),
        ];
    }

    /**
     * @return \SprykerEco\Zed\AvalaraTaxExtension\Dependency\Plugin\CreateTransactionRequestAfterPluginInterface[]
     */
    protected function getCreateTransactionRequestAfterPlugins(): array
    {
        return [
            new AvalaraShipmentCreateTransactionRequestAfterPlugin(),
        ];
    }
}
Verification
  1. Add an item to a cart.
  2. Proceed to checkout.
  3. On the summary page, you should see the calculated tax amount for your order, including the taxes for shipment methods.
  1. Update the following data import files:
FILE NAME COLUMN TO ADD LOCATION
shipment.csv avalara_tax_code data/import/common/common/shipment.csv
  1. To handle the new field, adjust the Shipment data importer using the following example:

data/import/common/common/shipment.csv

>shipment_method_key,name,carrier,taxSetName,avalaraTaxCode
spryker_dummy_shipment-standard,Standard,Spryker Dummy Shipment,Shipment Taxes,PC040111

Import data

Import data using the following command:

console data:import shipment
Verification

Make sure that the data has been imported to spy_shipment_method.

Next steps

Apply Avalara tax codes