${function(){
const {discount_type, discount_value, prerequisite_value, prerequisite_type, obtain_product, max_free_shipping} = data.campaign?.reward.discount_code_activity || {};
let value = '';
let unit = '';
if (discount_type === 'fixed_amount') {
value = ``;
}
if (discount_type === 'percentage') {
value = `${parseInt(discount_value)}%`;
unit = `RABATT`;
}
if (discount_type === 'free_shipping') {
if (max_free_shipping !== -1) {
value = `
KOSTENLOS
VERSAND
`;
} else {
value = `KOSTENLOS`;
unit = `VERSAND`;
}
}
if (discount_type === 'buy_x_get_y') {
const x = prerequisite_value;
const y = obtain_product.product_count;
const obtain_value = obtain_product.obtain_value;
if(obtain_product.obtain_type === 'free') {
value = `KOSTENLOS`;
unit = `PRODUKT`;
}
if(obtain_product.obtain_type === 'percentage') {
value = `${obtain_value}%`;
unit = `RABATT`;
}
if(obtain_product.obtain_type === 'fixed_amount') {
value = ``;
}
}
return `
${value}
${unit}
`;
}()}
${function(){
const {discount_type, prerequisite_value, prerequisite_type, obtain_product} = data.campaign?.reward.discount_code_activity || {};
if (discount_type !== 'buy_x_get_y') {
return `${data.campaign?.name}`;
}
return '';
}()}
${function(){
const {discount_type, prerequisite_value, prerequisite_type, obtain_product} = data.campaign?.reward.discount_code_activity || {};
if (discount_type === 'buy_x_get_y') {
const x = prerequisite_value;
const y = obtain_product.product_count;
const obtain_value = obtain_product.obtain_value;
if(obtain_product.obtain_type === 'free') {
if (prerequisite_type === 'quantity') {
return `Kaufe ${x} und erhalte ${y} kostenlos`;
} else if (prerequisite_type === 'subtotal') {
return `Kaufe und erhalte ${y} kostenlos`;
}
}
if(obtain_product.obtain_type === 'percentage') {
if (prerequisite_type === 'quantity') {
return `Kaufe ${x}, erhalte ${y} mit ${obtain_value}% RABATT`;
} else if (prerequisite_type === 'subtotal') {
return `Kaufe , erhalte ${y} mit ${obtain_value}% RABATT`;
}
}
if(obtain_product.obtain_type === 'fixed_amount') {
if (prerequisite_type === 'quantity') {
return `Kaufe ${x} und erhalte ${y} mit Rabatt pro Stück`;
} else if (prerequisite_type === 'subtotal') {
return `Kaufe und erhalte ${y} mit Rabatt pro Stück`;
}
}
}
return '';
}()}
${data.discount_code}
${function(){
const { prerequisite_type, prerequisite_value, discount_type, obtain_product, max_free_shipping } = data.campaign?.reward.discount_code_activity || {};
if (prerequisite_type === 'none' && discount_type === 'free_shipping' && max_free_shipping !== -1) {
return `Bis zu , kein Mindestbetrag`;
}
if (prerequisite_type === 'quantity' && discount_type === 'free_shipping' && max_free_shipping !== -1) {
return `Bis zu , die Bestellung ist verfügbar, wenn sie mindestens ${parseInt(prerequisite_value)} Artikel enthält`;
}
if (prerequisite_type === 'subtotal' && discount_type === 'free_shipping' && max_free_shipping !== -1) {
return `Bis zu , verfügbar, wenn der Bestellwert über liegt`;
}
if (prerequisite_type === 'none') {
return `Kein Mindestbetrag`;
}
if (prerequisite_type === 'quantity') {
return `Die Bestellung ist verfügbar, wenn sie mindestens ${parseInt(prerequisite_value)} Artikel enthält`;
}
if (prerequisite_type === 'subtotal') {
return `Verfügbar, wenn der Bestellwert über liegt`;
}
if (discount_type === 'free_shipping' && max_free_shipping !== -1 ) {
return `Bis zu `
}
}()}