【发布时间】:2020-03-24 20:59:07
【问题描述】:
我写了这个函数:
add_action( 'woocommerce_before_calculate_totals', 'adding_custom_price', 10, 1);
function adding_custom_price( $cart ) {
global $woocommerce;
foreach ( $cart->get_cart() as $cart_item ) {
//If there is minimum 1 coupon active
if (!empty(WC()->cart->applied_coupons)) {
}
//If there isn't any coupon in cart
else {
//Here I want to do some styling in CSS or run something in jQuery
}
}
}
我想在其中做一些 CSS 并在 else 中运行一些 jQuery,我该怎么做?
【问题讨论】:
-
你不能在 PHP 代码中运行 CSS / JQuery。
标签: php jquery css wordpress woocommerce