mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Update the price info, create helper util
This commit is contained in:
parent
06e74e74f4
commit
e2092d23f0
5 changed files with 145 additions and 41 deletions
18
modules/ppcp-settings/resources/js/utils/badgeBoxUtils.js
Normal file
18
modules/ppcp-settings/resources/js/utils/badgeBoxUtils.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { __ } from '@wordpress/i18n';
|
||||
|
||||
const generatePriceText = (type, selectedCountryPrice, storeCurrency) => {
|
||||
if (!selectedCountryPrice || !selectedCountryPrice[type]) {
|
||||
console.warn(`Invalid type or price data for: ${type}`);
|
||||
return '';
|
||||
}
|
||||
|
||||
const percentage = selectedCountryPrice[type].toFixed(2);
|
||||
const fixedFee = `${selectedCountryPrice.currencySymbol}${selectedCountryPrice.fixedFee}`;
|
||||
|
||||
return __(
|
||||
`from ${percentage}% + ${fixedFee} ${storeCurrency}<sup>1</sup>`,
|
||||
'woocommerce-paypal-payments'
|
||||
);
|
||||
};
|
||||
|
||||
export default generatePriceText;
|
Loading…
Add table
Add a link
Reference in a new issue