使用挂钩在产品页面上添加额外费用 [Woocommerce]
Add Extra Fee on Product Page Using Hook [Woocommerce]
add_filter( 'woocommerce_get_price_html', 'product_page_price_display', 9999, 2 );
函数 product_page_price_display( $price_html, $product ) {
$orig_price = wc_get_price_to_display( $product );
$price_html = wc_price( $orig_price + 10 );
return $price_html;
}
add_filter( 'woocommerce_get_price_html', 'product_page_price_display', 9999, 2 );
函数 product_page_price_display( $price_html, $product ) {
$orig_price = wc_get_price_to_display( $product );
$price_html = wc_price( $orig_price + 10 );
return $price_html;
}
add_filter( 'woocommerce_get_price_html', 'product_page_price_display', 9999, 2 ); 函数 product_page_price_display( $price_html, $product ) {
$orig_price = wc_get_price_to_display( $product );
$price_html = wc_price( $orig_price + 10 );
return $price_html;
}
add_filter( 'woocommerce_get_price_html', 'product_page_price_display', 9999, 2 ); 函数 product_page_price_display( $price_html, $product ) {
$orig_price = wc_get_price_to_display( $product );
$price_html = wc_price( $orig_price + 10 );
return $price_html;
}