@plentymarkets/shop-api / offerGetters
Variable: offerGetters ​
constofferGetters:object
Defined in: getters/offerGetters.ts:164
Type Declaration ​
getBillingAddress ​
getBillingAddress: (
offer) =>Address|null
Returns the mapped billing address from the offer, or null if not set.
Parameters ​
offer ​
The offer object.
Returns ​
Address | null
The billing Address, or null if billing address data is not available.
getItemsCountInOffer ​
getItemsCountInOffer: (
items) =>number
Returns the total quantity of items in the offer (excluding the last administrative item). Returns 0 if the offer has fewer than two items.
Parameters ​
items ​
The array of offer order items.
Returns ​
number
The summed quantity of all items except the last one.
getOfferEmail ​
getOfferEmail: (
offer) =>string
Returns the email address from the offer's billing address, validated before returning.
Parameters ​
offer ​
The offer object.
Returns ​
string
A valid email address string, or an empty string if the email is invalid or not set.
getOfferItemOriginalPrice ​
getOfferItemOriginalPrice: (
offerItem) =>number
Returns the original gross unit price of an offer item.
Parameters ​
offerItem ​
The offer order item.
Returns ​
number
The gross price as a number.
getOfferItemOriginalPriceWithQuantity ​
getOfferItemOriginalPriceWithQuantity: (
item) =>number
Returns the gross line total (unit price × quantity) for an offer item.
Parameters ​
item ​
The offer order item.
Returns ​
number
The line total as a number.
getOfferItemQty ​
getOfferItemQty: (
item) =>number
Returns the quantity of an offer item.
Parameters ​
item ​
The offer order item.
Returns ​
number
The item quantity.
getOfferItemsCount ​
getOfferItemsCount: (
offer) =>number
Returns the number of order items in the offer, excluding one reserved/administrative item.
Parameters ​
offer ​
The offer object.
Returns ​
number
The item count (at least 0).
getOfferItemVariationName ​
getOfferItemVariationName: (
variation) =>string
Returns the display name (name1) of the product variation in an offer item.
Parameters ​
variation ​
The product variation object.
Returns ​
string
The variation name string, or an empty string if not set.
getPaymentMethodIconPath ​
getPaymentMethodIconPath: (
offer) =>string
Returns the icon path/URL for the payment method used in the offer.
Parameters ​
offer ​
The offer object.
Returns ​
string
The payment method icon path string.
getPaymentMethodName ​
getPaymentMethodName: (
offer) =>string
Returns the display name of the payment method used in the offer.
Parameters ​
offer ​
The offer object.
Returns ​
string
The payment method name string.
getShippingAddress ​
getShippingAddress: (
offer) =>Address|null
Returns the mapped shipping address from the offer, or null if not set.
Parameters ​
offer ​
The offer object.
Returns ​
Address | null
The shipping Address, or null if delivery address data is not available.
getShippingMethodCosts ​
getShippingMethodCosts: (
offer) =>number
Returns the gross shipping costs for the offer.
Parameters ​
offer ​
The offer object.
Returns ​
number
The shipping gross amount as a number.
getShippingMethodName ​
getShippingMethodName: (
offer) =>string
Returns the combined shipping method name in "<profileName> - <providerName>" format.
Parameters ​
offer ​
The offer object.
Returns ​
string
The combined shipping method name, or an empty string if either part is missing.
getValidUntil ​
getValidUntil: (
offer,locale) =>string|null
Returns the "valid until" date of the offer formatted as a localised date string. Uses the date with type ID 20 from the order dates.
Parameters ​
offer ​
The offer object.
locale? ​
string = 'en'
The BCP 47 locale string to use for date formatting (defaults to "en").
Returns ​
string | null
The formatted date string, or null if the valid-until date is not set.
isTypeOffer ​
isTypeOffer: (
offer) =>boolean
Returns whether the offer is of type "offer" (type ID 7).
Parameters ​
offer ​
The offer object.
Returns ​
boolean
true if the order type ID is 7, otherwise false.