individuelle Versandkosten Berechnung mit TWIG Vorlagen

Produktnummer: AcrisShippingCalculation
Produktinformationen "individuelle Versandkosten Berechnung mit TWIG Vorlagen"

Highlights

Versandkosten manuell berechnen lassen Versandberechnung auf der Detailseite der Versandart manuell hinzufügen LineItems selbst bestimmen Vertriebkanäle selbst wählen

Features

Manuelle Versandkosten Berechnung Für jede Versandart möglich Indiviudelle Berechnung für einzelne Versandarten

Nutzung des Plugins

Das Plugin fügt die Möglichkeit hinzu, den Versand manuell zu berechnen. Mithilfe von lineitems vom Warenkorb können Sie diese zur Berechnung des Versands verwenden. Das Feld "Versandberechnung" basiert auf der Twig-Vorlage und die Twig-Funktionen sollten in Operationen mit Daten aufgerufen werden.
In "lineItems" sind alle Produkte aus dem Warenkorb. Und dort sind aktuelle "salesChannel" Daten hinzugefügt.

Ermöglicht somit komplexeste Versandkostenermittlung mit relativ einfachen Mitteln (TWIG) via Shopware Admin Oberfläche.


Funktionsweise

  • Es ist möglich, die Versandberechnung auf der Detailseite der Versandart manuell hinzuzufügen.
  • Standardwerte hinzugefügt:
    • Vertriebskanal
    • LineItems (lineItem funktioniert nur bei foreach-Schleife).
  • Wenn kein Float-Wert zurückgegeben werden kann, wird der nächste Matrixpreis (falls vorhanden) oder der Standardpreis verwendet.


Manuelle Berechnung der Versandkosten

Im Bereich Einstellungen -> Shop-> Versand -> Versandart anlegen oder bearbeiten

Hier ist es möglich über eine Preismatrix, den Versand manuell berechnen zu lassen.


Sie haben hier lineItems vom Warenkorb und können diese zur Berechnung des Versands verwenden.


Beispiel #1: (Versandkosten fix auf 10 ohne weiterer Regeln)

{% set shipping = 10 %}

{{ shipping }}


Beispiel #2: (Versandkosten erhöhen sich um einen Wert, abhängig davon ob ein Artikel mit dem CustomField im Warenkorb liegt)

{% set shipping = 10 %}
{% for lineItem in lineItems %}
    {% if lineItem.payload.customFields.custom_sw4_attributes_attr7 == "1" %}
        {% set shipping = shipping + 1 %}
    {% endif %}
{% endfor %}
{{ shipping }}


Beispiel #3: (Versandkosten je nachdem in welchen Kategorien sich die Produkte Warenkorb befinden)

{% set numberProductsInsideCategory1 = 0 %}
{% set numberProductsInsideCategory2 = 0 %}

{% for lineItem in lineItems %}
    {% if lineItem.payload.categoryIds %}
        {% for categoryId in lineItem.payload.categoryIds %}
            {# Is product inside category 1 - we check it by the UUID #}
            {% if categoryId == '21b199946c884aa294b409f135963880' %}
                {% set numberProductsInsideCategory1 = numberProductsInsideCategory1 + 1 %}
            {% endif %}

            {# Is product inside category 2 - we check it by the UUID? #}
            {% if categoryId == '0b5e8204e7034c2ca17a3899274874a4' %}
                {% set numberProductsInsideCategory2 = numberProductsInsideCategory2 + 1 %}
            {% endif %}
        {% endfor %}
    {% endif %}
{% endfor %}

{# Now we can do something with the variables numberProductsInsideCategory1 and numberProductsInsideCategory2 #}
{% if numberProductsInsideCategory1 > 0 and numberProductsInsideCategory2 > 0 %}
    19.90
{% elseif numberProductsInsideCategory1 > 0 %}
    14.90
{% elseif numberProductsInsideCategory2 > 0 %}
    12.90
{% else %}
    9.90
{% endif %}

Hinweis: Es sind im Warenkorb nur die UUIDs der Kategorien (einmalige ID in der Datenbank) verfügbar. Die UUID kannst du sehr einfach über das Plugin https://store.shopware.com/acris28622190382f/acris-kategorie-id-anzeigen.html auslesen und kopieren.


Beispiel #4: Mengen Ermittlung

{% set quantity = 0 %}
{% for lineItem in lineItems %}
    {% if lineItem.quantity %}
        {% set quantity = quantity + lineItem.quantity %}
    {% endif %}
{% endfor %}

{{ quantity }}


Beispiel #5: Kunden Freitextfeld Freihausgrenze

{% set customerShippingFreeLimit = false %}
{% if customer.customFields is not empty and customer.customFields.custom_customer_shipping_free_limit > 0 %}
    {% set customerShippingFreeLimit = customer.customFields.custom_customer_shipping_free_limit %}
{% endif %}

{% set shippingCosts = 9.95 %}
{% if customerShippingFreeLimit > 0 and cart.price.totalPrice >= customerShippingFreeLimit  %}
    {% set shippingCosts = 0 %}
{% endif %}

{{ shippingCosts }}


Beispiel #6: Hinzufügen der Mehrwertsteuer je nach Lieferland und Warenkorbinhalt zum Nettopreis der Versandkosten

{% set shippingNet = 100 %}

{% if context.taxState == 'gross' and matchingTaxRules and matchingTaxRules.highestRate() %}
    {% set shippingNet = shippingNet / 100 * matchingTaxRules.highestRate().getPercentage() %}
    {% set shipping = shippingNet * (1 + (matchingTaxRules.highestRate().getTaxRate() / 100)) %}
{% else %}
    {% set shipping = shippingNet %}
{% endif %}

{{ shipping }}


Beispiel #7: Berechnung der Versandkosten abhängig von Brutto / Netto im Warenkorb

{% if context.taxState == 'gross' %}
     {# do smth if tax state is gross #}
 {% else %}
     {# do smth if tax state is net #}
 {% endif %}


---


Folgende Variablen sind aktuell verfügbar - wenn sie weiter Variablen benötigen, dann bitte eine Supportanfrage über den Shopware Account an uns stellen.


Auflistung der möglichen Variablen

matchingTaxRules (Steuern, die für die Versandart relevant sind, ermittelt über Steuer-Typ - PHP-Klasse TaxRuleCollection)

  • matchingTaxRules.highestRate().getTaxRate()

currency

  • currency.isoCode
  • currency.factor
  • currency.symbol
  • currency.shortName
  • currency.name
  • currency.position
  • currency.translations
  • currency.orders
  • currency.salesChannels
  • currency.salesChannelDefaultAssignments
  • currency.salesChannelDomains
  • currency.shippingMethodPrices
  • currency.promotionDiscountPrices
  • currency.isSystemDefault
  • currency.productExports
  • currency.countryRoundings
  • currency.itemRounding
  • currency.totalRounding
  • currency.taxFreeFrom
  • currency.translated.customFields

context

  • context.languageIdChain
  • context.versionId
  • context.currencyId
  • context.currencyFactor
  • context.scope
  • context.ruleIds
  • context.source
  • context.considerInheritance
  • context.taxState
  • context.rounding

ruleIds - array with active rule ids

customer

  • customer.groupId
  • customer.defaultPaymentMethodId
  • customer.salesChannelId
  • customer.languageId
  • customer.lastPaymentMethodId
  • customer.defaultBillingAddressId
  • customer.defaultShippingAddressId
  • customer.customerNumber
  • customer.salutationId
  • customer.firstName
  • customer.lastName
  • customer.company
  • customer.password
  • customer.email
  • customer.title
  • customer.vatIds
  • customer.affiliateCode
  • customer.campaignCode
  • customer.active
  • customer.doubleOptInRegistration
  • customer.doubleOptInEmailSentDate
  • customer.doubleOptInConfirmDate
  • customer.hash
  • customer.guest
  • customer.firstLogin
  • customer.lastLogin
  • customer.newsletter
  • customer.birthday
  • customer.lastOrderDate
  • customer.orderCount
  • customer.orderTotalAmount
  • customer.createdAt
  • customer.updatedAt
  • customer.legacyEncoder
  • customer.legacyPassword
  • customer.group
  • customer.defaultPaymentMethod
  • customer.salesChannel
  • customer.language
  • customer.lastPaymentMethod
  • customer.salutation
  • customer.defaultBillingAddress
  • customer.defaultShippingAddress
  • customer.activeBillingAddress
  • customer.activeShippingAddress
  • customer.addresses
  • customer.orderCustomers
  • customer.autoIncrement
  • customer.tags
  • customer.tagIds
  • customer.promotions
  • customer.recoveryCustomer
  • customer.productReviews
  • customer.remoteAddress
  • customer.requestedGroupId
  • customer.requestedGroup
  • customer.boundSalesChannelId
  • customer.boundSalesChannel
  • customer.wishlists
  • customer.customFields

cart

  • cart.name
  • cart.token
  • cart.price.netPrice
  • cart.price.totalPrice
  • cart.price.calculatedTaxes
  • cart.price.taxRules
  • cart.price.positionPrice
  • cart.price.taxStatus
  • cart.price.rawTotal
  • cart.lineItems
  • cart.errors
  • cart.deliveries
  • cart.transactions
  • cart.modified
  • cart.customerComment
  • cart.affiliateCode
  • cart.campaignCode
  • cart.data
  • cart.ruleIds

lineItems - array with line item

lineItem

  • lineItem.id
  • lineItem.referencedId
  • lineItem.label
  • lineItem.quantity
  • lineItem.type
  • lineItem.priceDefinition
  • lineItem.price
  • lineItem.good
  • lineItem.description
  • lineItem.cover
  • lineItem.deliveryInformation
  • lineItem.children
  • lineItem.requirement
  • lineItem.removable
  • lineItem.stackable
  • lineItem.quantityInformation
  • lineItem.modified
  • lineItem.dataTimestamp
  • lineItem.dataContextHash
  • lineItem.payload
  • lineItem.payload.isCloseout
  • lineItem.payload.customFields
  • lineItem.payload.createdAt
  • lineItem.payload.releaseDate
  • lineItem.payload.isNew
  • lineItem.payload.markAsTopseller
  • lineItem.payload.purchasePrices
  • lineItem.payload.productNumber
  • lineItem.payload.manufacturerId
  • lineItem.payload.taxId
  • lineItem.payload.tagIds
  • lineItem.payload.categoryIds
  • lineItem.payload.propertyIds
  • lineItem.payload.optionIds
  • lineItem.payload.options
  • lineItem.payload.length
  • lineItem.payload.height
  • lineItem.payload.width
  • lineItem.payload.deliveryTime
  • lineItem.payload.features
  • lineItem.deliveryInformation.weight

salesChannel

  • salesChannel.typeId
  • salesChannel.languageId
  • salesChannel.currencyId
  • salesChannel.paymentMethodId
  • salesChannel.shippingMethodId
  • salesChannel.countryId
  • salesChannel.navigationCategoryId
  • salesChannel.navigationCategoryDepth
  • salesChannel.homeSlotConfig
  • salesChannel.homeCmsPageId
  • salesChannel.homeCmsPage
  • salesChannel.homeEnabled
  • salesChannel.homeName
  • salesChannel.homeMetaTitle
  • salesChannel.homeMetaDescription
  • salesChannel.homeKeywords
  • salesChannel.footerCategoryId
  • salesChannel.serviceCategoryId
  • salesChannel.name
  • salesChannel.shortName
  • salesChannel.accessKey
  • salesChannel.currencies
  • salesChannel.languages
  • salesChannel.configuration
  • salesChannel.active
  • salesChannel.maintenance
  • salesChannel.maintenanceIpWhitelist
  • salesChannel.taxCalculationType
  • salesChannel.type
  • salesChannel.currency
  • salesChannel.language
  • salesChannel.paymentMethod
  • salesChannel.shippingMethod
  • salesChannel.country
  • salesChannel.orders
  • salesChannel.customers
  • salesChannel.countries
  • salesChannel.paymentMethods
  • salesChannel.shippingMethods
  • salesChannel.translations
  • salesChannel.domains
  • salesChannel.systemConfigs
  • salesChannel.navigationCategory
  • salesChannel.footerCategory
  • salesChannel.serviceCategory
  • salesChannel.productVisibilities
  • salesChannel.mailHeaderFooterId
  • salesChannel.numberRangeSalesChannels
  • salesChannel.mailHeaderFooter
  • salesChannel.customerGroupId
  • salesChannel.customerGroup
  • salesChannel.newsletterRecipients
  • salesChannel.promotionSalesChannels
  • salesChannel.documentBaseConfigSalesChannels
  • salesChannel.productReviews
  • salesChannel.seoUrls
  • salesChannel.seoUrlTemplates
  • salesChannel.mainCategories
  • salesChannel.paymentMethodIds
  • salesChannel.productExports
  • salesChannel.hreflangActive
  • salesChannel.hreflangDefaultDomainId
  • salesChannel.hreflangDefaultDomain
  • salesChannel.analyticsId
  • salesChannel.analytics
  • salesChannel.customerGroupsRegistrations
  • salesChannel.eventActions
  • salesChannel.boundCustomers
  • salesChannel.wishlists
  • salesChannel.landingPages
  • salesChannel.translated.customFields

shippingMethod

  • shippingMethod.translated.name
  • shippingMethod.active
  • shippingMethod.description
  • shippingMethod.trackingUrl
  • shippingMethod.deliveryTimeId
  • shippingMethod.deliveryTime
  • shippingMethod.translations
  • shippingMethod.orderDeliveries
  • shippingMethod.salesChannelDefaultAssignments
  • shippingMethod.salesChannels
  • shippingMethod.availabilityRule
  • shippingMethod.availabilityRuleId
  • shippingMethod.prices
  • shippingMethod.mediaId
  • shippingMethod.taxId
  • shippingMethod.media
  • shippingMethod.tags
  • shippingMethod.taxType
  • shippingMethod.tax
  • shippingMethod.translated.customFields

paymentMethod

  • paymentMethod.pluginId
  • paymentMethod.handlerIdentifier
  • paymentMethod.translated.name
  • paymentMethod.distinguishableName
  • paymentMethod.description
  • paymentMethod.position
  • paymentMethod.active
  • paymentMethod.afterOrderEnabled
  • paymentMethod.plugin
  • paymentMethod.translations
  • paymentMethod.orderTransactions
  • paymentMethod.customers
  • paymentMethod.salesChannelDefaultAssignments
  • paymentMethod.salesChannels
  • paymentMethod.availabilityRule
  • paymentMethod.availabilityRuleId
  • paymentMethod.mediaId
  • paymentMethod.media
  • paymentMethod.formattedHandlerIdentifier
  • paymentMethod.shortName
  • paymentMethod.appPaymentMethod
  • paymentMethod.translated.customFields

customerGroup

  • customerGroup.name
  • customerGroup.translated.name
  • customerGroup.displayGross
  • customerGroup.translations
  • customerGroup.customers
  • customerGroup.salesChannels
  • customerGroup.registrationActive
  • customerGroup.registrationTitle
  • customerGroup.registrationIntroduction
  • customerGroup.registrationOnlyCompanyRegistration
  • customerGroup.registrationSeoMetaDescription
  • customerGroup.registrationSalesChannels
  • customerGroup.translated.customFields

taxRules (Auflistung der im Shop verfügbaren Steuern - PHP-Klasse TaxCollection)

  • taxRules.ids
  • taxRules.elements

Erweiterung ab Pluginversion 2.2.0 - Ermittlung des Steuersatzes

Der für die Versandart relevante Steuersatz wird in Shopware über den "Steuer-Typ" (Auto, Höchster Satz oder Fester Satz) ermittelt. Das Ergebnis daraus speichern wir ab sofort in der Variablen "matchingTaxRules", diese entspricht der PHP-Klasse https://github.com/shopware/platform/blob/trunk/src/Core/Checkout/Cart/Tax/Struct/TaxRuleCollection.php. Sie können somit den aktuell höchsten Steuersatz im Warenkorb über die folgende Twig-Variable auslesen:
{{ matchingTaxRules.highestRate().getTaxRate() }} Mit diesem Steuersatz können Sie nun rechnen.
Version
Min. Shopware Version
Veröffentlicht am
Änderungen
Version
4.0.1
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.6.0.0
Veröffentlicht am
25. März 2024
Änderungen

- Aktualisierte Pipeline-Datei

Version
4.0.0
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.6.0.0
Veröffentlicht am
20. März 2024
Änderungen

- Kompatibilität mit Shopware 6.6.

Version
3.1.1
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.5.0.0
Veröffentlicht am
15. Januar 2024
Änderungen

- Optimiert die Aktualisierung des Plugins.

Version
3.1.0
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.5.0.0
Veröffentlicht am
3. November 2023
Änderungen

- Fügt die Daten der Basiseinheit und der Verkaufseinheit zur Nutzlast der Positionen im Warenkorb hinzu.

Version
3.0.2
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.5.0.0
Veröffentlicht am
28. August 2023
Änderungen

- Verbessert die Plugin-Kompatibilität.

Version
3.0.1
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.5.0.0
Veröffentlicht am
5. Juli 2023
Änderungen

- Verbessert die Plugin-Kompatibilität.

Version
3.0.0
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.4.0.0
Veröffentlicht am
7. März 2023
Änderungen

- Kompatibilität mit Shopware 6.5.

Version
2.3.4
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.4.0.0
Veröffentlicht am
15. Februar 2023
Änderungen

- Änderung des Pluginnamens und der Hersteller Links.

Version
2.3.3
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.4.0.0
Veröffentlicht am
26. November 2022
Änderungen

- Optimiert die Versandberechnung bei der Neuberechnung des Warenkorbs.

Version
2.3.2
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.4.0.0
Veröffentlicht am
26. November 2022
Änderungen

- Behebt ein Problem, bei dem berechnete Versandkosten einen Wert von 0 ergeben.

Version
2.3.1
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.4.0.0
Veröffentlicht am
26. November 2022
Änderungen

- Behebt ein Problem bei dem der Shop nach einer Änderung des Versandkosten Templates beim ersten Aufruf nicht erreichbar ist.

Version
2.3.0
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.4.0.0
Veröffentlicht am
26. November 2022
Änderungen

- Ab sofort ist es in der Versandkostenberechnung möglich eigene Twig Funktionen aus anderen Plugins zu nutzen.

Version
2.2.2
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.4.0.0
Veröffentlicht am
26. November 2022
Änderungen

- Optimiert das Plugin-Image.

- Verbessert die Kompatibilität mit Shopware >= 6.4.10.0.

Version
2.2.1
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.4.0.0
Veröffentlicht am
26. November 2022
Änderungen

- Optimiert Lieferungsrechner auf manuelle Berechnung.

Version
2.2.0
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.4.0.0
Veröffentlicht am
26. November 2022
Änderungen

- Ermittelt die für die Lieferung relevanten Steuersätze und fügt sie als mögliche Variable in Twig hinzu.

Version
2.1.0
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.4.0.0
Veröffentlicht am
26. November 2022
Änderungen

- Fügt neue Variablen für die Versandberechnung hinzu.

Version
2.0.2
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.4.0.0
Veröffentlicht am
26. November 2022
Änderungen

- Hinzufügen von Vorschlägen für Warenkorbvariablen in der Versandberechnungsvorlage.

Version
2.0.1
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.4.0.0
Veröffentlicht am
26. November 2022
Änderungen

- Der Vorlage für die Versandberechnung wurde der Warenkorb hinzugefügt.

Version
2.0.0
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.4.0.0
Veröffentlicht am
26. November 2022
Änderungen

- Kompatibilität mit Shopware 6.4* hergestellt.

Version
1.0.4
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.3.0.0
Veröffentlicht am
26. November 2022
Änderungen

- Verbessert die Kompatibilität mit Shopware Version > 6.3.0.0 und <= 6.3.3.1.

Version
1.0.3
Min. Shopware Version
Veröffentlicht am
Min. Shopware Version
>=6.3.0.0
Veröffentlicht am
26. November 2022
Änderungen

- Validierung der Versandberechnung hinzugefügt.

0 von 0 Bewertungen

Bewerten Sie dieses Produkt!

Teilen Sie Ihre Erfahrungen mit anderen Kunden.


Ähnliche Produkte

Rabatte & Aktionen Info Text
SEO Weiterleitungen (Redirect 301 / 302) Pro
Währungumschaltung: Wechsel der Währung aufgrund von Rulebuilder Regeln
Persönlicher Ansprechpartner + regelgesteuert + gruppiert anzeigen lassen
Händler Kundengruppe Registrierung anstelle Standard Kundengruppe
Erlebniswelten - Rollen & Rechte für Blöcke und Elemente
Testsystem/ Staging Umgebung erstellen (ohne Zusatzkosten für Plugins)
MUST HAVE
Flow Builder Erweiterung: Zeitliche Verzögerung (Minuten, Stunden, Tage)
Kundenkonto / Warenkorb / Checkout Anpassungen APP
Individuelle Produktsortierung in Kategorien
Produkt Info Text
CrossSelling Produkte gleiche Kategorie + zuletzt angesehen + Kunden kauften auch + zusammen gesehen