springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-18 12:57:27
157
我使用这个代码来向客户显示,如果客户想要支付几个月的分期付款,那么几个月的费用是多少。
但该代码应该只适用于10美元以上的项目,而对10美元以下的项目无效。
有人有什么建议吗?
add_action( 'woocommerce_single_product_summary', 'show_emi', 1 );
function show_emi() {
global $product;
$id = $product->get_id();
$product = wc_get_product( $id );
$a=$product->get_price();
$b = 20;
$c = 100;
$d = $a / $b;
$total = $a / $b;
echo '<div class="afbetaling">
<b> Eller kun '.$total.' kr./md i 20 mdr. </b>
0% i rente og gebyrer. <br> Få mere info i butikken</div>';
}
顺晟科技:
您的代码包含一些小错误或使用了一些优化
global $product;
获取该对象的产品ID,然后使用该产品ID获取产品对象。这是一个不必要的步骤,因为您已经可以访问$product
$a
、$b
和$c
__( string $text, string $domain = 'default' )
函数可以使文本可翻译所以你得到:
function action_woocommerce_single_product_summary() {
// Get the global product object
global $product;
// Is a WC product
if ( is_a( $product, 'WC_Product' ) ) {
// Get price
$price = $product->get_price();
// Above 10
if ( $price > 10 ) {
// Settings
$months = 20;
$total = $price / $months;
// Message
$message = sprintf( __( '<strong>Or only DKK %s / month for %s months</strong>, 0%% in interest and fees. Get more info in the store', 'woocommerce' ), $total, $months );
// Output
echo '<div class="afbetaling">' . $message . '</div>';
}
}
}
add_action( 'woocommerce_single_product_summary', 'action_woocommerce_single_product_summary', 10, 0 );
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11