Magento 2

Overview

The Nysa_ShipRateAPIextension adds ShipRateAPI as a native shipping carrier in Magento 2. At checkout, Magento calls the extension's collectRates()method, which builds a payload from the cart and destination, POSTs it to the ShipRateAPI API server-side, and maps the response back to Magento rate objects — all without the API key ever reaching the browser.

  • Magento 2.4+ / Adobe Commerce 2.4+
  • PHP 8.1 or higher
  • Composer 2
Installation

Install via Composer from your Magento root:

composer require nysa/shiprate
bin/magento module:enable Nysa_ShipRateAPI
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean

The setup:upgrade step runs the data patch that creates the shiprate_tags product attribute. If you are deploying to a production environment, run setup:static-content:deploy afterwards.

Admin configuration

Navigate to Stores → Configuration → Sales → Shipping Methods → ShipRateAPI Live Rates.

FieldDescription
EnabledSet to Yes to activate the carrier at checkout
TitleLabel displayed to customers in the checkout shipping group (default: ShipRateAPI Live Rates)
API Endpoint URLThe ShipRateAPI quotes endpoint — e.g. https://api.shiprateapi.com/api/v1/quotes. Stored in full so the version path can be updated without a code release. The extension sends X-Platform: magento2 automatically.
API KeyYour ShipRateAPI API key. Stored encrypted in core_config_data.
Sort OrderDisplay order relative to other carriers at checkout
Attribute Tag MappingRule table mapping product attribute values to ShipRateAPI tags (see below)
Product tagging

Tags are sent per line item in the API payload and can be used in the ShipRateAPI admin to control carrier routing (e.g. only show cold-chain carriers for products tagged cold-storage). There are two ways to assign tags:

Layer 1 — Direct tags via product attribute

The extension installs a shiprate_tags varchar attribute on the product entity. To tag a product, edit it in Catalog → Products, open the ShipRateAPI tab, and enter a comma-separated list:

cold-storage, fragile, medicine
Layer 2 — Attribute mapping rules

The Attribute Tag Mapping table in the carrier config lets you derive tags from any existing product attribute without editing each product individually. Each row defines a rule:

ColumnDescription
Product Attribute CodeAny EAV product attribute code (e.g. hazmat_class). Validated against the catalog on save.
Operatorequals (=), not equals (!=), or contains
Attribute ValueThe value to compare the product attribute against
ShipRateAPI TagThe tag to append when the rule matches

Tags from both layers are merged and deduplicated before being sent. See Tags & Routing for how tags affect carrier selection.