Come aggiungere un attributo di prodotto personalizzato come filtro per le tariffe di spedizione
Pubblicato: 2020-04-07Spesso, in Magento 2, il numero di attributi di prodotto standard che possono essere utilizzati per impostare le condizioni è limitato. Sarebbe necessaria una personalizzazione aggiuntiva per soddisfare le esigenze aziendali.
Da questo articolo imparerai come raggiungere questo obiettivo e aggiungere attributi di prodotto personalizzati come filtro per le tariffe di spedizione.
Appunti:
- Vedi l'esempio di codice completo su GitHub.
- La prima parte dell'esempio, che aggiunge l'attributo 'Volume Weight' come filtro alle tariffe di spedizione, è disponibile qui.
- È richiesto il modulo originale Magento 2 Shipping Suite Ultimate.
Andiamo subito a discutere di cosa si deve fare esattamente per raggiungere l'obiettivo.
Sommario
- Guida dettagliata sull'aggiunta di attributi di prodotti personalizzati
- Passaggio 1. Crea un nuovo modulo aggiungendo i file di base
- Passaggio 2. Creare una struttura del modulo
- Passaggio 3. Interfaccia utente
- Modulo
- Griglia
Guida dettagliata sull'aggiunta di attributi di prodotti personalizzati
Passaggio 1. Crea un nuovo modulo aggiungendo i file di base
Inizia nominando il modulo:
> app/code/MageWorx/ShippingRateByProductAttribute/registration.php <?php /** * Copyright MageWorx. All rights reserved. * See LICENSE.txt for license details. */ \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'MageWorx_ShippingRateByProductAttribute', __DIR__ );
Quindi, rileva e dichiara i suoi requisiti. Dovrai anche dare un nome al nostro modulo per il compositore, impostare la versione e aggiungere una breve descrizione:
> app/code/MageWorx/ShippingRateByProductAttribute/composer.json { "name": "mageworx/module-shipping-rate-by-product-attribute", "description": "Shipping Rules Extension: Adds product attribute to the Rates", "require": { "magento/module-shipping": ">=100.1.0 < 101", "magento/module-ui": ">=100.1.0 < 102", "mageworx/module-shippingrules": ">=2.7.1" }, "type": "magento2-module", "version": "1.0.0", "license": [ "OSL-3.0", "AFL-3.0" ], "autoload": { "files": [ "registration.php" ], "psr-4": { "MageWorx\\ShippingRateByProductAttribute\\": "" } } }
Inoltre, possiamo impostare il nome iniziale e la versione nella configurazione di Magento 2, dichiarare la sequenza:
> app/code/MageWorx/ShippingRateByProductAttribute/etc/module.xml <?xml version="1.0"?> <!-- /** * Copyright MageWorx. All rights reserved. * See LICENSE.txt for license details. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="MageWorx_ShippingRateByProductAttribute" setup_version="1.0.0"> <sequence> <module name="MageWorx_ShippingRules" /> </sequence> </module> </config>
Passaggio 2. Creare una struttura del modulo
Supponiamo di avere un attributo di prodotto denominato "shippingnew", che è stato creato dal lato amministratore. È un tipo di input a discesa e ha poche opzioni denominate "A, B, C, D", ecc. Queste opzioni descrivono come spediamo i nostri articoli per zone. Ogni valore ha il suo prezzo e i prodotti con il prezzo più alto modificheranno il costo del metodo di spedizione durante il checkout.
Prima di tutto, dobbiamo creare una tabella separata per le nostre condizioni estese delle tariffe di spedizione. Successivamente, li aggiungeremo utilizzando i normali attributi di estensione del modello (il modello "Tariffa di spedizione" estende "\Magento\Framework\Model\AbstractExtensibleModel").
> app/code/MageWorx/ShippingRateByProductAttribute/Setup/InstallSchema.php <?php /** * Copyright MageWorx. All rights reserved. * See LICENSE.txt for license details. */ namespace MageWorx\ShippingRateByProductAttribute\Setup; use Magento\Framework\DB\Ddl\Table; use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface; /** * Class InstallSchema */ class InstallSchema implements InstallSchemaInterface { /** * Installs DB schema for a module * * @param SchemaSetupInterface $setup * @param ModuleContextInterface $context * @return void * @throws \Zend_Db_Exception */ public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); $ratesTable = $installer->getTable(\MageWorx\ShippingRules\Model\Carrier::RATE_TABLE_NAME); /** * Create table 'mageworx_shippingrules_rates_shippingnew' */ $table = $installer->getConnection()->newTable( $installer->getTable('mageworx_shippingrules_rates_shippingnew') )->addColumn( 'rate_id', Table::TYPE_INTEGER, null, ['unsigned' => true, 'nullable' => false], 'Rate Id' )->addColumn( 'shippingnew', Table::TYPE_TEXT, '120', ['nullable' => false], 'shippingnew attribute value' )->addForeignKey( $installer->getFkName('mageworx_shippingrules_rates_shippingnew', 'rate_id', $ratesTable, 'rate_id'), 'rate_id', $ratesTable, 'rate_id', Table::ACTION_CASCADE )->addIndex( $installer->getIdxName( 'mageworx_shippingrules_rates_product_attributes', ['rate_id', 'shippingnew'], \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE ), ['rate_id', 'shippingnew'], ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] )->setComment( 'Product Attributes For Shipping Suite Rates' ); $installer->getConnection()->createTable($table); } }
Abbiamo chiamato la nostra tabella come segue: `'mageworx_shippingrules_rates_shippingnew'`. Ha solo 2 colonne. Uno di questi viene utilizzato come chiave esterna. È la colonna `rate_id`, che sarà collegata alla normale tabella `mageworx_shippingrules_rates` dal modulo MageWorx Shipping Suite Ultimate per Magento 2. Un'altra colonna conterrà i valori dell'attributo `shippingnew`.
Prima di fare in modo che un osservatore carichi/salvi/elimini i nostri dati personalizzati nella tabella, dobbiamo creare almeno due modelli: modello regolare e modello risorsa.
> app/code/MageWorx/ShippingRateByProductAttribute/Model/ShippingNew.php <?php /** * Copyright MageWorx. All rights reserved. * See LICENSE.txt for license details. */ namespace MageWorx\ShippingRateByProductAttribute\Model; use Magento\Framework\Model\AbstractModel; /** * Class ShippingNew */ class ShippingNew extends AbstractModel { /** * Prefix of model events names * * @var string */ protected $_eventPrefix = 'mageworx_shippingnew'; /** * Parameter name in event * * In observe method you can use $observer->getEvent()->getObject() in this case * * @var string */ protected $_eventObject = 'shippingnew'; /** * Set resource model and Id field name * * @return void */ protected function _construct() { parent::_construct(); $this->_init('MageWorx\ShippingRateByProductAttribute\Model\ResourceModel\ShippingNew'); $this->setIdFieldName('rate_id'); } }
Appunti:
- ` _eventPrefix ` verrà utilizzato per rilevare gli eventi del nostro modello.
- `_eventObject` verrà utilizzato per memorizzare i dati nell'oggetto evento. Usando questo nome possiamo ottenere il nostro modello dall'oggetto evento.
- `$this->_init( 'MageWorx\ShippingRateByProductAttribute\Model\ResourceModel\ ShippingNew' );` collega il nostro modello con il modello di risorsa corrispondente.
- `$this->setIdFieldName( 'rate_id' );` descrive quale campo della tabella deve essere usato come chiave (di solito lo chiamiamo id)
> app/code/MageWorx/ShippingRateByProductAttribute/Model/ResourceModel/ShippingNew.php <?php /** * Copyright MageWorx. All rights reserved. * See LICENSE.txt for license details. */ namespace MageWorx\ShippingRateByProductAttribute\Model\ResourceModel; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; /** * Class ShippingNew */ class ShippingNew extends AbstractDb { /** * Resource initialization * * @return void */ protected function _construct() { $this->_init('mageworx_shippingrules_rates_shippingnew', 'rate_id'); } /** * @param $rateId * @param int $shippingNew * @return int * @throws \Magento\Framework\Exception\LocalizedException */ public function insertUpdateRecord($rateId, int $shippingNew) { $rowsAffected = $this->getConnection()->insertOnDuplicate( $this->getMainTable(), [ 'rate_id' => $rateId, 'shippingnew' => $shippingNew ] ); return $rowsAffected; } /** * @param $rateId * @return int * @throws \Magento\Framework\Exception\LocalizedException */ public function deleteRecord($rateId) { $rowsAffected = $this->getConnection()->delete( $this->getMainTable(), [ 'rate_id = ?' => $rateId ] ); return $rowsAffected; } }
Appunti:
- $this->_init( 'mageworx_shippingrules_rates_shippingnew' , 'rate_id' ); impostare il nome della tabella principale e il nome del campo ID.
- public function insertUpdateRecord($rateId, int $shippingNew) è il metodo che potrebbe aiutarci ad aggiornare il valore dell'attributo nella nostra tabella personalizzata.
- la funzione public deleteRecord($rateId) è progettata per rimuovere la colonna.
In seguito, useremo questi metodi nei nostri osservatori.
Ora aggiungiamo i nostri nuovi dati come attributo di estensione al modello di tariffa di spedizione:
> app/code/MageWorx/ShippingRateByProductAttribute/etc/extension_attributes.xml <?xml version="1.0"?> <!-- /** * Copyright MageWorx. All rights reserved. * See LICENSE.txt for license details. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd"> <!-- Rate Extension --> <extension_attributes for="MageWorx\ShippingRules\Api\Data\RateInterface"> <attribute code="shippingnew" type="int"> <join reference_table="mageworx_shippingrules_rates_shippingnew" reference_field="rate_id" join_on_field="rate_id"> <field>shippingnew</field> </join> </attribute> </extension_attributes> </config>
Dovremmo anche occuparci delle operazioni regolari della nostra condizione personalizzata:
> app/code/MageWorx/ShippingRateByProductAttribute/etc/events.xml <?xml version="1.0"?> <!-- /** * Copyright MageWorx. All rights reserved. * See LICENSE.txt for license details. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <!-- Add Extension Attributes to the Rates Collection --> <!-- Save custom attribute value during rate saving --> <event name="mageworx_shippingrules_rate_save_after"> <observer name="mageworx_save_shippingnew_attribute" instance="MageWorx\ShippingRateByProductAttribute\Observer\SaveShippingNewRateAttribute" /> </event> <!-- Add custom attribute value to the rates collection --> <event name="rates_collection_render_filters_before"> <observer name="mageworx_add_shippingnew_attribute" instance="MageWorx\ShippingRateByProductAttribute\Observer\AddShippingNewToRatesCollection" /> </event> <!-- Take care of filtering the rates grid --> <event name="mageworx_suitable_rates_collection_load_before"> <observer name="mageworx_filter_rates_by_shippingnew_attribute" instance="MageWorx\ShippingRateByProductAttribute\Observer\FilterRatesCollectionByShippingNewAttribute" /> </event> <!-- 3 event observers for the Export/Import rates with custom attribute in conditions --> <event name="mageworx_rates_export_collection_join_linked_tables_after"> <observer name="mageworx_join_shipping_new_table_to_export_rates_collection" instance="MageWorx\ShippingRateByProductAttribute\Observer\JoinShippingNewTableToExportRatesCollection" /> </event> <event name="mageworx_filter_rates_data_before_insert"> <observer name="mageworx_remove_shipping_new_before_insert" instance="MageWorx\ShippingRateByProductAttribute\Observer\RemoveShippingNewBeforeInsert" /> </event> <event name="mageworx_shippingrules_import_insert_rates"> <observer name="mageworx_shippingrules_import_insert_update_shipping_new" instance="MageWorx\ShippingRateByProductAttribute\Observer\InsertUpdateShippingNewDuringImport" /> </event> </config>
Il primo evento riguarda il salvataggio/aggiornamento/eliminazione del valore dell'attributo personalizzato nella condizione delle tariffe.
I secondi due eventi servono per aggiungere questo valore di attributo alla raccolta.
Gli ultimi tre eventi riguardano la funzionalità di importazione/esportazione.
Analizziamoli uno per uno in modo più dettagliato:
> app/code/MageWorx/ShippingRateByProductAttribute/Observer/SaveShippingNewRateAttribute.php <?php /** * Copyright MageWorx. All rights reserved. * See LICENSE.txt for license details. */ namespace MageWorx\ShippingRateByProductAttribute\Observer; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; use Magento\Framework\Exception\LocalizedException; use MageWorx\ShippingRules\Api\Data\RateInterface; /** * Class SaveShippingNewRateAttribute * * Saves custom attribute (`shippingnew`) values after model was saved */ class SaveShippingNewRateAttribute implements ObserverInterface { /** * @var \MageWorx\ShippingRateByProductAttribute\Model\ResourceModel\ShippingNew */ private $resource; /** * @var \Magento\Framework\Message\ManagerInterface */ private $messagesManager; /** * SaveVolumeWeightRateAttribute constructor. * * @param \MageWorx\ShippingRateByProductAttribute\Model\ResourceModel\ShippingNew $resource * @param \Magento\Framework\Message\ManagerInterface $messagesManager */ public function __construct( \MageWorx\ShippingRateByProductAttribute\Model\ResourceModel\ShippingNew $resource, \Magento\Framework\Message\ManagerInterface $messagesManager ) { $this->resource = $resource; $this->messagesManager = $messagesManager; } /** * @param Observer $observer * @return void */ public function execute(Observer $observer) { /** @var RateInterface $model */ $model = $observer->getEvent()->getData('rate'); if (!$model instanceof RateInterface) { return; } $shippingNewValue = $model->getData('shippingnew') !== '' ? $model->getData('shippingnew') : null; if ($shippingNewValue === null) { try { $this->resource->deleteRecord($model->getRateId()); } catch (LocalizedException $deleteException) { $this->messagesManager->addErrorMessage( __('Unable to delete the Shipping Category for the Rate %1', $model->getRateId()) ); } } else { try { $this->resource->insertUpdateRecord($model->getRateId(), $shippingNewValue); } catch (LocalizedException $saveException) { $this->messagesManager->addErrorMessage( __('Unable to save the Shipping Category for the Rate %1', $model->getRateId()) ); } } return; } }
E 'così semplice. Quando salviamo una tariffa, dobbiamo occuparci di salvare anche il valore dell'attributo personalizzato. Nel caso in cui il suo valore sia uguale a `null`, elimina semplicemente un record.

> app/code/MageWorx/ShippingRateByProductAttribute/Observer/AddShippingNewToRatesCollection.php <?php /** * Copyright MageWorx. All rights reserved. * See LICENSE.txt for license details. */ namespace MageWorx\ShippingRateByProductAttribute\Observer; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; /** * Class AddShippingNewToRatesCollection * * Adds custom attribute to the rates collection. * It will be used later during quote validation. */ class AddShippingNewToRatesCollection implements ObserverInterface { /** * Join custom table to the rates collection to obtain the `shippingnew` attribute anywhere in the code. * * @param Observer $observer * @return void */ public function execute(Observer $observer) { /** @var \MageWorx\ShippingRules\Model\ResourceModel\Rate\Collection $collection */ $collection = $observer->getEvent()->getData('collection'); if (!$collection instanceof \MageWorx\ShippingRules\Model\ResourceModel\Rate\Collection) { return; } if ($collection->isLoaded()) { return; } $joinTable = $collection->getTable('mageworx_shippingrules_rates_shippingnew'); $collection->getSelect() ->joinLeft( $joinTable, '`main_table`.`rate_id` = `' . $joinTable . '`.`rate_id`', ['shippingnew'] ); } }
Per rendere disponibile la convalida, quando un cliente va alla cassa o alla stima delle tariffe di spedizione, uniamoci alla nostra tabella con l'attributo personalizzato alla tabella delle tariffe regolari.
> app/code/MageWorx/ShippingRateByProductAttribute/Observer/FilterRatesCollectionByShippingNewAttribute.php <?php /** * Copyright MageWorx. All rights reserved. * See LICENSE.txt for license details. */ namespace MageWorx\ShippingRateByProductAttribute\Observer; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; /** * Class FilterRatesCollectionByShippingNewAttribute * * Filter rates collection before we load it by custom attribute: shippingnew. * * For more details * * @see \MageWorx\ShippingRules\Model\Carrier\Artificial::getSuitableRatesAccordingRequest() * */ class FilterRatesCollectionByShippingNewAttribute implements ObserverInterface { /** * @param Observer $observer * @return void */ public function execute(Observer $observer) { /** @var \MageWorx\ShippingRules\Model\ResourceModel\Rate\Collection $collection */ $collection = $observer->getEvent()->getData('rates_collection'); if (!$collection instanceof \MageWorx\ShippingRules\Model\ResourceModel\Rate\Collection) { return; } /** @var \Magento\Quote\Model\Quote\Address\RateRequest $request */ $request = $observer->getEvent()->getData('request'); if (!$request instanceof \Magento\Quote\Model\Quote\Address\RateRequest) { return; } /** @var \Magento\Quote\Model\Quote\Item[] $items */ $items = $request->getAllItems() ?? []; $shippingCategories = []; foreach ($items as $item) { $value = $item->getProduct()->getData('shippingnew'); if ($value !== null) { $shippingCategories[] = $value; } } $shippingCategories = array_unique($shippingCategories); $joinTable = $collection->getTable('mageworx_shippingrules_rates_shippingnew'); $collection->getSelect() ->joinLeft( ['sn' => $joinTable], '`main_table`.`rate_id` = `sn`.`rate_id`', ['shippingnew'] ); $collection->getSelect()->where( "`sn`.`shippingnew` IN (?)", $shippingCategories ); } }
Questo è l'osservatore più complicato nel nostro stack. È progettato per raccogliere tutti i valori degli attributi (`$shippingCategories`) dal carrello di un cliente e aggiunge il valore dell'attributo come filtro alla normale raccolta delle tariffe (la nostra tabella è già unita). Per semplificare, l'ho chiamato "Filtro". Al termine del lavoro, un cliente vedrà le tariffe di spedizione effettive per gli articoli del carrello correnti.
Altri 3 osservatori di eventi sono progettati per aggiungere e ricevere dati personalizzati durante l'esportazione e l'importazione delle tariffe di spedizione. Saltiamo il suo codice nel post del blog, ma sarà disponibile nel repository con il codice sorgente.
Passaggio 3. Interfaccia utente
È ora di aggiungere il nostro attributo alla griglia e alla forma delle tariffe di spedizione.
Modulo
> app/code/MageWorx/ShippingRateByProductAttribute/view/adminhtml/ui_component/mageworx_shippingrules_rate_form.xml <?xml version="1.0" encoding="UTF-8"?> <!-- /** * Copyright MageWorx. All rights reserved. * See LICENSE.txt for license details. */ --> <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <fieldset name="conditions"> <field name="shippingnew"> <argument name="data" xsi:type="array"> <item name="options" xsi:type="object">MageWorx\ShippingRateByProductAttribute\Model\Config\Source\ShippingCategory</item> <item name="config" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Shipping Category</item> <item name="dataType" xsi:type="string">int</item> <item name="formElement" xsi:type="string">select</item> <item name="dataScope" xsi:type="string">shippingnew</item> <item name="source" xsi:type="string">mageworx_shippingrules_rate_form.custom_attributes</item> </item> </argument> </field> </fieldset> </form>
Griglia
> app/code/MageWorx/ShippingRateByProductAttribute/view/adminhtml/ui_component/mageworx_shippingrules_rates_regular_listing.xml <?xml version="1.0"?> <!-- Copyright MageWorx. All rights reserved. See LICENSE.txt for license details. --> <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Ui/etc/ui_configuration.xsd"> <columns name="mageworx_shippingrules_rates_columns"> <column name="shippingnew"> <argument name="data" xsi:type="array"> <item name="options" xsi:type="object">MageWorx\ShippingRateByProductAttribute\Model\Config\Source\ShippingCategory</item> <item name="config" xsi:type="array"> <item name="filter" xsi:type="string">select</item> <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/select</item> <item name="dataType" xsi:type="string">select</item> <item name="label" xsi:type="string" translate="true">Shipping Category</item> <item name="visible" xsi:type="boolean">true</item> <item name="sortOrder" xsi:type="number">40</item> <item name="editor" xsi:type="string">select</item> </item> </argument> </column> </columns> </listing>
Come puoi vedere, utilizziamo il modello di origine personalizzato in quei file. Creiamolo. Caricherà un attributo corrispondente ("shippingnew") e ci darà tutti i valori disponibili.
> app/code/MageWorx/ShippingRateByProductAttribute/Model/Config/Source/ShippingCategory.php <?php /** * Copyright MageWorx. All rights reserved. * See LICENSE.txt for license details. */ namespace MageWorx\ShippingRateByProductAttribute\Model\Config\Source; use Magento\Framework\Exception\LocalizedException; /** * Class ShippingCategory * * Obtain options for specified product attribute */ class ShippingCategory extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource { /** * @var \Magento\Catalog\Api\ProductAttributeRepositoryInterface */ protected $productAttributeRepository; /** * @var \Psr\Log\LoggerInterface */ protected $logger; /** * ShippingCategory constructor. * * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $productAttributeRepository * @param \Psr\Log\LoggerInterface $logger */ public function __construct( \Magento\Catalog\Api\ProductAttributeRepositoryInterface $productAttributeRepository, \Psr\Log\LoggerInterface $logger ) { $this->productAttributeRepository = $productAttributeRepository; $this->logger = $logger; } /** * @inheritDoc */ public function getAllOptions() { if (empty($this->_options)) { try { /** @var \Magento\Catalog\Api\Data\ProductAttributeInterface $attribute */ $attribute = $this->productAttributeRepository->get('shippingnew'); $this->_options = $attribute->usesSource() ? $attribute->getSource()->getAllOptions() : []; } catch (LocalizedException $localizedException) { $this->logger->critical($localizedException->getLogMessage()); } } return $this->_options; } }
Il pezzo di codice è piuttosto semplice. Usiamo il repository degli attributi per caricare il nostro attributo e quindi ottenere tutte le opzioni (valori) da esso. Tieni presente che l'attributo con il codice `shippingnew` deve essere creato nel pannello di amministrazione e deve avere un tipo di input a discesa con opzioni (valori) predefinite. Puoi farlo dal menu "Negozi > Attributi > Prodotto". Non dimenticare di aggiungere questo attributo al set di attributi che stai utilizzando per i prodotti.
Quando tutto è fatto, dobbiamo solo abilitare il modulo ed eseguire `setup:upgrade`. La cache verrà cancellata automaticamente.
Vai alla griglia delle tariffe ("Negozi > Tariffe di spedizione") e vedrai la nuova colonna:
Tale condizione sarà disponibile all'interno del modulo delle tariffe:
Se impostiamo l'impostazione "Calcolo del prezzo di tariffe multiple" su "Utilizza tariffa con prezzo massimo" nel metodo di spedizione corrispondente, durante il calcolo del prezzo di spedizione verrà utilizzata la tariffa con il prezzo più alto.
Ecco un piccolo esempio di come funziona sotto forma di screenshot:
- Configura i tuoi prodotti
- Imposta le tariffe
- Imposta l'algoritmo di calcolo del prezzo (nel modulo del metodo di spedizione)
- Controlla il prezzo di spedizione per il metodo corrispondente con i prodotti selezionati nel carrello (sul frontend).
Questo non è tutto ciò di cui è capace il modulo Shipping Suite. Sentiti libero di giocare con le impostazioni per ottenere il risultato desiderato.
Sarò felice di rispondere a qualsiasi domanda! Quindi, sentiti libero di lasciare i tuoi commenti nel campo dedicato qui sotto.