PluginProbe
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO / 1.4.19
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO v1.4.19
1.4.19 1.4.18 1.4.17 1.4.16 1.4.15 1.4.14 1.4.13 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.54 1.3.53 1.3.52 1.3.51 1.3.50 All 182 releases
← All changes | backend/views/components/Main/utilities/utilities.js +25 -0 1.4.0 → 1.4.19 View file →
@@ -336,4 +336,29 @@
336 336 return str.slice(0, maxLength) + '...';
337 337 }
338 338 return str;
339 339 }
340 +
341 +/**
342 + *
343 + * @param {String} rawText
344 + * @returns {String}
345 + */
346 +export const renderBadgeText = (rawText) => {
347 + const text = typeof rawText === 'string' ? rawText : '';
348 + return text
349 + .replace(/\[discounted_percentage\]/g, '20%')
350 + .replace(/\[discounted_amount\]/g, '$10')
351 + .replace(/\[remaining_quantity\]/g, '5')
352 + .replace(/\[remaining_amount\]/g, '$50')
353 + .replace(/\[remaining_cart_items\]/g, '2');
354 +};
355 +
356 +/**
357 + *
358 + * @param {Object} radius
359 + * @returns {String}
360 + */
361 +export const getBorderRadius = (radius) => {
362 + if (!radius) return undefined;
363 + return `${radius['top-left'] || '0px'} ${radius['top-right'] || '0px'} ${radius['bottom-right'] || '0px'} ${radius['bottom-left'] || '0px'}`;
364 +};